PostId
int64 4
11.8M
| PostCreationDate
stringlengths 19
19
| OwnerUserId
int64 1
1.57M
| OwnerCreationDate
stringlengths 10
19
| ReputationAtPostCreation
int64 -55
461k
| OwnerUndeletedAnswerCountAtPostTime
int64 0
21.5k
| Title
stringlengths 3
250
| BodyMarkdown
stringlengths 5
30k
⌀ | Tag1
stringlengths 1
25
⌀ | Tag2
stringlengths 1
25
⌀ | Tag3
stringlengths 1
25
⌀ | Tag4
stringlengths 1
25
⌀ | Tag5
stringlengths 1
25
⌀ | PostClosedDate
stringlengths 19
19
⌀ | OpenStatus
stringclasses 5
values | unified_texts
stringlengths 32
30.1k
| OpenStatus_id
int64 0
4
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11,430,185 | 07/11/2012 10:02:44 | 773,366 | 05/27/2011 15:24:44 | 10 | 0 | 502 error with nginx + uwsgi +django | I've tried to configure django on top on nginx and uwsgi and a 502 bad gateway error is encountered when trying to access localhost
This is my /etc/ngingx/sites-available/default file
server {
server_name testapp1.com www.testapp1.com;
access_log /var/log/nginx/testapp1.com.access.log;
location / {
uwsgi_pass unix:///var/run/uwsgi/app/testapp1/socket;
include uwsgi_params;
}
}
This is my testapp1.ini file in /etc/nginx/apps-available/
[uwsgi]
thread=3
master=1
env = DJANGO_SETTINGS_MODULE=testapp1.settings
module = django.core.handlers.wsgi:WSGIHandler()
chdir = /home/paul/apps/testapp1
socket = /run/uwsgi/testapp1/socket
logto = /var/log/uwsgi/testapp1.log
This is the uwsgi.log file
Tue Jul 10 21:49:38 2012 - *** Starting uWSGI 1.0.3-debian (32bit) on [Tue Jul 10 21:49:38 2012] ***
Tue Jul 10 21:49:38 2012 - compiled with version: 4.6.2 on 20 February 2012 10:06:16
Tue Jul 10 21:49:38 2012 - current working directory: /
Tue Jul 10 21:49:38 2012 - writing pidfile to /run/uwsgi/app/testapp1/pid
Tue Jul 10 21:49:38 2012 - detected binary path: /usr/bin/uwsgi-core
Tue Jul 10 21:49:38 2012 - setgid() to 33
Tue Jul 10 21:49:38 2012 - setuid() to 33
Tue Jul 10 21:49:38 2012 - your memory page size is 4096 bytes
Tue Jul 10 21:49:38 2012 - uwsgi socket 0 bound to UNIX address /run/uwsgi/app/testapp1/socket fd 5
Tue Jul 10 21:49:38 2012 - bind(): No such file or directory [socket.c line 107]
I didnt change the nginx.conf file.
| django | nginx | uwsgi | null | null | null | open | 502 error with nginx + uwsgi +django
===
I've tried to configure django on top on nginx and uwsgi and a 502 bad gateway error is encountered when trying to access localhost
This is my /etc/ngingx/sites-available/default file
server {
server_name testapp1.com www.testapp1.com;
access_log /var/log/nginx/testapp1.com.access.log;
location / {
uwsgi_pass unix:///var/run/uwsgi/app/testapp1/socket;
include uwsgi_params;
}
}
This is my testapp1.ini file in /etc/nginx/apps-available/
[uwsgi]
thread=3
master=1
env = DJANGO_SETTINGS_MODULE=testapp1.settings
module = django.core.handlers.wsgi:WSGIHandler()
chdir = /home/paul/apps/testapp1
socket = /run/uwsgi/testapp1/socket
logto = /var/log/uwsgi/testapp1.log
This is the uwsgi.log file
Tue Jul 10 21:49:38 2012 - *** Starting uWSGI 1.0.3-debian (32bit) on [Tue Jul 10 21:49:38 2012] ***
Tue Jul 10 21:49:38 2012 - compiled with version: 4.6.2 on 20 February 2012 10:06:16
Tue Jul 10 21:49:38 2012 - current working directory: /
Tue Jul 10 21:49:38 2012 - writing pidfile to /run/uwsgi/app/testapp1/pid
Tue Jul 10 21:49:38 2012 - detected binary path: /usr/bin/uwsgi-core
Tue Jul 10 21:49:38 2012 - setgid() to 33
Tue Jul 10 21:49:38 2012 - setuid() to 33
Tue Jul 10 21:49:38 2012 - your memory page size is 4096 bytes
Tue Jul 10 21:49:38 2012 - uwsgi socket 0 bound to UNIX address /run/uwsgi/app/testapp1/socket fd 5
Tue Jul 10 21:49:38 2012 - bind(): No such file or directory [socket.c line 107]
I didnt change the nginx.conf file.
| 0 |
11,430,189 | 07/11/2012 10:03:05 | 511,488 | 11/17/2010 23:52:19 | 321 | 4 | iconv and greek filenames | I'm having a problem displaying images with greek filenames (ie 'φωτογραφία.jpg') in a browser . Using this script I found out which 2 encodings I need to use with iconv() so I can get the filename to display correctly in a browser, the image itself though, fails to render.
<?
$file = 'φωτογραφία.jpg';
$encodings = array("UTF-8", "ASCII", "Windows-1253", "ISO-8859-1", "UTF-16");
$iconv = "";
foreach ($encodings as $i) {
foreach ($encodings as $j) {
if($j!==$i) $iconv .= "<br /> $i -> $j: ".iconv($i, $j, $file);
}
}
echo $iconv;
?>
Working link [here][1]
which retuns the correct filename when converting from UTF-8 -> Windows-1253.
The environment is PHP 5.2.17 on Apache/2.2.22 (Unix) and the files have been uploaded from a windows machine. Currently, I've only tested 2-3 images by hardcoding them into a test php file, do you think it would be different if the filenames were pulled from a database query?
[1]: http://www.ht-webcreations.com/test/ | php | unicode | iconv | null | null | null | open | iconv and greek filenames
===
I'm having a problem displaying images with greek filenames (ie 'φωτογραφία.jpg') in a browser . Using this script I found out which 2 encodings I need to use with iconv() so I can get the filename to display correctly in a browser, the image itself though, fails to render.
<?
$file = 'φωτογραφία.jpg';
$encodings = array("UTF-8", "ASCII", "Windows-1253", "ISO-8859-1", "UTF-16");
$iconv = "";
foreach ($encodings as $i) {
foreach ($encodings as $j) {
if($j!==$i) $iconv .= "<br /> $i -> $j: ".iconv($i, $j, $file);
}
}
echo $iconv;
?>
Working link [here][1]
which retuns the correct filename when converting from UTF-8 -> Windows-1253.
The environment is PHP 5.2.17 on Apache/2.2.22 (Unix) and the files have been uploaded from a windows machine. Currently, I've only tested 2-3 images by hardcoding them into a test php file, do you think it would be different if the filenames were pulled from a database query?
[1]: http://www.ht-webcreations.com/test/ | 0 |
11,430,190 | 07/11/2012 10:03:15 | 424,886 | 08/19/2010 06:44:31 | 176 | 6 | What LINQ opperation could be slowing down my query? | I've written a pretty generic LINQ query which is used throughout my app and works very well for all cases but one. I'm only running SQL Express at the moment so can't jump into sql profiler until my download completes, so until then, is there something that stands out in my following LINQ that is going to cause a massive slow down?
Below is a summary of what gets executed. The hold up is of course on the ToList call, and takes a good 30 seconds. I use this code for all my grid views, and only one has the hold up on it. MyGridView is a sql view and in the problem data takes only 2 seconds to execute and return all 16417 records through Sql Management Studio. Finally, it only takes this long when I request pages near the end of the data, so I am assuming it is some how related to the Take and Skip implementation.
private void Demo()
{
// using LINQ To Entity...
using (var entities = new MyEntities())
{
int page = 1641;
int pageSize = 10;
IQueryable<MyGridView> results = entities.MyGridView;
results = results.Where(r => r.DeletedDate == null);
var resultCount = results.Count();
results = ApplyPaging(results, page, pageSize);
// On the problem data, ToList takes a good 30 seconds to return just 10 records
var resultList = results.ToList();
}
}
private IQueryable<T> ApplyPaging<T>(IQueryable<T> data, int currentPage, int pageSize)
{
if (pageSize > 0 && currentPage > 0)
{
data = data.Skip((currentPage - 1) * pageSize);
}
data = data.Take(pageSize);
return data;
}
Anything jump out as being bad, wrong, dangerous? When I get a copy of profiler installed I'll try and go through the generated sql and post if I find any hints there.
| .net | linq | sql-server-2008 | linq-to-entities | null | null | open | What LINQ opperation could be slowing down my query?
===
I've written a pretty generic LINQ query which is used throughout my app and works very well for all cases but one. I'm only running SQL Express at the moment so can't jump into sql profiler until my download completes, so until then, is there something that stands out in my following LINQ that is going to cause a massive slow down?
Below is a summary of what gets executed. The hold up is of course on the ToList call, and takes a good 30 seconds. I use this code for all my grid views, and only one has the hold up on it. MyGridView is a sql view and in the problem data takes only 2 seconds to execute and return all 16417 records through Sql Management Studio. Finally, it only takes this long when I request pages near the end of the data, so I am assuming it is some how related to the Take and Skip implementation.
private void Demo()
{
// using LINQ To Entity...
using (var entities = new MyEntities())
{
int page = 1641;
int pageSize = 10;
IQueryable<MyGridView> results = entities.MyGridView;
results = results.Where(r => r.DeletedDate == null);
var resultCount = results.Count();
results = ApplyPaging(results, page, pageSize);
// On the problem data, ToList takes a good 30 seconds to return just 10 records
var resultList = results.ToList();
}
}
private IQueryable<T> ApplyPaging<T>(IQueryable<T> data, int currentPage, int pageSize)
{
if (pageSize > 0 && currentPage > 0)
{
data = data.Skip((currentPage - 1) * pageSize);
}
data = data.Take(pageSize);
return data;
}
Anything jump out as being bad, wrong, dangerous? When I get a copy of profiler installed I'll try and go through the generated sql and post if I find any hints there.
| 0 |
11,471,534 | 07/13/2012 13:32:34 | 1,523,638 | 07/13/2012 13:12:09 | 1 | 0 | java applet ie win7 | I have a 10-year-old applet which has worked nicely on all browsers/platforms prior to Win7/IE. On Win7/IE, 32bit and 64bit, the applet loads but does not size correctly to fill the browser window in the vertical dimension. Horizontal dimension is fine. Firefox, Chrome, Safari are fine on Win7, the glitch is only with Win7/IE. No errors in the Java Console.
I'm using the object/comment/embed html syntax, as:
<object classid="blah" width="100%" height="100%" codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_6_0-win.cab#Version=1,6,0,00">
<param name="code" value="lots.of.packages.then.class">
<param name="codebase" value="/goes/here">
<param name="archive" value="foo.jar">
<param name="type" value="application/x-java-applet;version=1.6">
<param name="scriptable" value="false">
<param name="MAYSCRIPT" value="true">
<comment>
<embed
type="application/x-java-applet;version=1.6"
width="100%"
height="100%"
code="lots.of.packages.then.class"
codebase="/goes/here"
archive="foo.jar"
MAYSCRIPT=true
pluginspage="http://java.sun.com/products/plugin/autodl/jinstall-1_6_0-win.cab">
<noembed>
No support for APPLET!!
</noembed>
</embed>
</comment>
</object>
Note the percentage syntax for the width and height attributes: `width="100%" height="100%"`.
Has anyone seen this problem with the vertical dimension on Win7 before? Suggestions much appreciated.
--Mark | java | internet-explorer | windows-7 | applet | null | null | open | java applet ie win7
===
I have a 10-year-old applet which has worked nicely on all browsers/platforms prior to Win7/IE. On Win7/IE, 32bit and 64bit, the applet loads but does not size correctly to fill the browser window in the vertical dimension. Horizontal dimension is fine. Firefox, Chrome, Safari are fine on Win7, the glitch is only with Win7/IE. No errors in the Java Console.
I'm using the object/comment/embed html syntax, as:
<object classid="blah" width="100%" height="100%" codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_6_0-win.cab#Version=1,6,0,00">
<param name="code" value="lots.of.packages.then.class">
<param name="codebase" value="/goes/here">
<param name="archive" value="foo.jar">
<param name="type" value="application/x-java-applet;version=1.6">
<param name="scriptable" value="false">
<param name="MAYSCRIPT" value="true">
<comment>
<embed
type="application/x-java-applet;version=1.6"
width="100%"
height="100%"
code="lots.of.packages.then.class"
codebase="/goes/here"
archive="foo.jar"
MAYSCRIPT=true
pluginspage="http://java.sun.com/products/plugin/autodl/jinstall-1_6_0-win.cab">
<noembed>
No support for APPLET!!
</noembed>
</embed>
</comment>
</object>
Note the percentage syntax for the width and height attributes: `width="100%" height="100%"`.
Has anyone seen this problem with the vertical dimension on Win7 before? Suggestions much appreciated.
--Mark | 0 |
11,471,538 | 07/13/2012 13:32:41 | 1,072,171 | 11/29/2011 20:46:05 | 1 | 0 | iPhone: Fontconfig error: Cannot load default config file | I have the following problem:
I included a static library of FontConfig libfontconfig.a into my **iPhone project**.
The application is building and i can run it on the device but when I do a call to a method that needs some functions of this library the application crashes with the following error
> **Fontconfig error: Cannot load default config file**
> **terminate called throwing an exception**
I read that this error normally occurs when FontConfig cannot find the fonts.conf file that is normally located in /etc/fonts.
But I cannot move that file to this directory of the iPhone. Has anyone a solution? Just copying the file to the application bundle did not help, as well.
I would appreciate any help. | iphone | ios | xcode | static-libraries | fontconfig | null | open | iPhone: Fontconfig error: Cannot load default config file
===
I have the following problem:
I included a static library of FontConfig libfontconfig.a into my **iPhone project**.
The application is building and i can run it on the device but when I do a call to a method that needs some functions of this library the application crashes with the following error
> **Fontconfig error: Cannot load default config file**
> **terminate called throwing an exception**
I read that this error normally occurs when FontConfig cannot find the fonts.conf file that is normally located in /etc/fonts.
But I cannot move that file to this directory of the iPhone. Has anyone a solution? Just copying the file to the application bundle did not help, as well.
I would appreciate any help. | 0 |
11,459,390 | 07/12/2012 19:39:50 | 283,357 | 03/01/2010 03:02:04 | 32 | 0 | ASP.NET MVC 3 Partial View in layout page | I'm working on setting up a shared content (navigation) for an asp.net MVC layout page.
Here is my partial view "_LayoutPartial.cshtml" with code to pull navigation data from a model.
@model MyApp.Models.ViewModel.LayoutViewModel
<p>
@foreach (var item in Model.navHeader)
{
//Test dump of navigation data
@Html.Encode(item.Name);
@Html.Encode(item.URL);
}
</p>
Here is how the code for my controller "LayoutController.cs" looks like.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MyApp.Models.ViewModel;
namespace MyApp.Controllers
{
public class LayoutController : Controller
{
//
// GET: /Layout/
LayoutViewModel layout = new LayoutViewModel();
public ActionResult Index()
{
return View(layout);
}
}
}
Here is the code for the "_Layout.cshtml" page. I'm attempting to call the partial view here using Html.RenderAction(Action,Controller) method.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<p>
@{Html.RenderAction("Index","Layout");}
</p>
@RenderBody()
</body>
</html>
When the layout page executes the @{Html.RenderAction("Index","Layout");} line, it throws out an error message "Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'."
What am I missing friends? How can I call a partial view in a layout page?
Thank you all in advance!
| asp.net | asp.net-mvc-2 | partial-views | null | null | null | open | ASP.NET MVC 3 Partial View in layout page
===
I'm working on setting up a shared content (navigation) for an asp.net MVC layout page.
Here is my partial view "_LayoutPartial.cshtml" with code to pull navigation data from a model.
@model MyApp.Models.ViewModel.LayoutViewModel
<p>
@foreach (var item in Model.navHeader)
{
//Test dump of navigation data
@Html.Encode(item.Name);
@Html.Encode(item.URL);
}
</p>
Here is how the code for my controller "LayoutController.cs" looks like.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MyApp.Models.ViewModel;
namespace MyApp.Controllers
{
public class LayoutController : Controller
{
//
// GET: /Layout/
LayoutViewModel layout = new LayoutViewModel();
public ActionResult Index()
{
return View(layout);
}
}
}
Here is the code for the "_Layout.cshtml" page. I'm attempting to call the partial view here using Html.RenderAction(Action,Controller) method.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<p>
@{Html.RenderAction("Index","Layout");}
</p>
@RenderBody()
</body>
</html>
When the layout page executes the @{Html.RenderAction("Index","Layout");} line, it throws out an error message "Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'."
What am I missing friends? How can I call a partial view in a layout page?
Thank you all in advance!
| 0 |
11,459,391 | 07/12/2012 19:40:02 | 1,226,369 | 02/22/2012 16:37:13 | 16 | 7 | how do I get a jquery slideshow to go to the next slide when user presses the right arrow key | OK so here is the scenario, I want the user to be able to press the right and left arrow keys on the keyboard and make the jquery slideshow on the page trigger the next slide. I would like to use the right arrow key but any key other than enter, space, or tab will do (I ONLY WANT ONE KEY TO DO THIS). I was thinking something like
$('#target').keyup(function(event){.doslide();}
or something any help will be greatly appreciated.
<script type="text/javascript">
var slo=null;
var sola = Array();
var prev = 0;
var cur = 1;
var timi=null
jQuery.noConflict()
jQuery(document).ready(function() {
sol = $(".slide")
var sho = document.getElementById('slidya').getElementsByTagName('a');
for(var i=1;i<sho.length-1;i++)sola.push(sho[i]);
for(var i=1;i<sol.length;i++)sol[i].style.display = 'none';
timi = window.setInterval('doslide()',10000);
})
function doslide()
{
$(sol[prev]).fadeOut(3000);
$(sol[cur]).fadeIn(3000);
sola[prev].className = 'number'
sola[cur].className = 'number select'
prev = cur++;
if(cur>sol.length-1)
{
cur=0;
prev= sol.length-1;
}
}
function prevnext(mode)
{
window.clearInterval(timi);timi=null;
if(mode)
{
if(cur>sol.length-1)
{
cur=0;
prev= sol.length-1;
}
doslide();
}
else
{
cur--;
prev--;
if(prev<0)
{
cur=0;
prev= sol.length-1;
}
if(cur<0)
{
cur=sol.length-1;
prev=cur-1 ;
}
$(sol[cur]).fadeOut(3000);
$(sol[prev]).fadeIn(3000);
sola[cur].className = 'number'
sola[prev].className = 'number select'
}
timi = window.setInterval('doslide()',10000)
}
function thisisit(aiyo)
{
cur = aiyo
window.clearInterval(timi);timi=null;
$(sol[cur]).fadeIn(1000);
$(sol[prev]).fadeOut(1000);
sola[cur].className = 'number select'
sola[prev].className = 'number'
prev=cur
++cur;
if(prev<0)prev = sol.length-1;
timi = window.setInterval('doslide()',10000)
}
</script> | jquery | slideshow | keyboard-events | next | keyup | null | open | how do I get a jquery slideshow to go to the next slide when user presses the right arrow key
===
OK so here is the scenario, I want the user to be able to press the right and left arrow keys on the keyboard and make the jquery slideshow on the page trigger the next slide. I would like to use the right arrow key but any key other than enter, space, or tab will do (I ONLY WANT ONE KEY TO DO THIS). I was thinking something like
$('#target').keyup(function(event){.doslide();}
or something any help will be greatly appreciated.
<script type="text/javascript">
var slo=null;
var sola = Array();
var prev = 0;
var cur = 1;
var timi=null
jQuery.noConflict()
jQuery(document).ready(function() {
sol = $(".slide")
var sho = document.getElementById('slidya').getElementsByTagName('a');
for(var i=1;i<sho.length-1;i++)sola.push(sho[i]);
for(var i=1;i<sol.length;i++)sol[i].style.display = 'none';
timi = window.setInterval('doslide()',10000);
})
function doslide()
{
$(sol[prev]).fadeOut(3000);
$(sol[cur]).fadeIn(3000);
sola[prev].className = 'number'
sola[cur].className = 'number select'
prev = cur++;
if(cur>sol.length-1)
{
cur=0;
prev= sol.length-1;
}
}
function prevnext(mode)
{
window.clearInterval(timi);timi=null;
if(mode)
{
if(cur>sol.length-1)
{
cur=0;
prev= sol.length-1;
}
doslide();
}
else
{
cur--;
prev--;
if(prev<0)
{
cur=0;
prev= sol.length-1;
}
if(cur<0)
{
cur=sol.length-1;
prev=cur-1 ;
}
$(sol[cur]).fadeOut(3000);
$(sol[prev]).fadeIn(3000);
sola[cur].className = 'number'
sola[prev].className = 'number select'
}
timi = window.setInterval('doslide()',10000)
}
function thisisit(aiyo)
{
cur = aiyo
window.clearInterval(timi);timi=null;
$(sol[cur]).fadeIn(1000);
$(sol[prev]).fadeOut(1000);
sola[cur].className = 'number select'
sola[prev].className = 'number'
prev=cur
++cur;
if(prev<0)prev = sol.length-1;
timi = window.setInterval('doslide()',10000)
}
</script> | 0 |
11,459,392 | 07/12/2012 19:40:16 | 1,467,507 | 06/19/2012 20:24:33 | 8 | 0 | Convert Twitter bootstrap tabs into a select menu | Anyone know how to convert Twitter Bootstrap tabs into a select menu? This would come in handy for a mobile layout. | tabs | twitter-bootstrap | null | null | null | null | open | Convert Twitter bootstrap tabs into a select menu
===
Anyone know how to convert Twitter Bootstrap tabs into a select menu? This would come in handy for a mobile layout. | 0 |
11,471,544 | 07/13/2012 13:33:07 | 425,459 | 08/19/2010 15:56:40 | 51 | 4 | Remove reliance on the Android clock entirely and use custom time from server | I have an application which records information using a tablet which is sync'ed to a server where reports are then run on the results. The users spend all day using the tablets and travel a lot throughout the day.
The time when the users complete these tasks is crucial to the reports and we have had several occurrences where we can't rely on the device time.
1. The user sometimes manually sets the time to something different on the device in order to look like they have done more work - this happens more than we expected
2. When relying on the time set to 'automatic', the time sometimes jumps around as the users travel between networks
3. When the tablet is initially switched on, sometimes the device time is set to 1970
I have a webservice to get the server time which is not currently used because we can't rely on the users having internet connection because they generally don't have any connection at all due to the nature of the work. However, they sync the data everyday usually, or at least once every few days.
I'd like to create something that gets the server time and counts the time from then on and the app would use this time. Any time they connect, this time will be updated, just to make certain the time is synced. Does anyone have any suggestions as to the best way to do this? Bear in mind that the time that we send up is crucial - it could be the case that if misreported on several occasions, someone could lose their job.
Thanks in advance! | java | android | web-services | time | null | null | open | Remove reliance on the Android clock entirely and use custom time from server
===
I have an application which records information using a tablet which is sync'ed to a server where reports are then run on the results. The users spend all day using the tablets and travel a lot throughout the day.
The time when the users complete these tasks is crucial to the reports and we have had several occurrences where we can't rely on the device time.
1. The user sometimes manually sets the time to something different on the device in order to look like they have done more work - this happens more than we expected
2. When relying on the time set to 'automatic', the time sometimes jumps around as the users travel between networks
3. When the tablet is initially switched on, sometimes the device time is set to 1970
I have a webservice to get the server time which is not currently used because we can't rely on the users having internet connection because they generally don't have any connection at all due to the nature of the work. However, they sync the data everyday usually, or at least once every few days.
I'd like to create something that gets the server time and counts the time from then on and the app would use this time. Any time they connect, this time will be updated, just to make certain the time is synced. Does anyone have any suggestions as to the best way to do this? Bear in mind that the time that we send up is crucial - it could be the case that if misreported on several occasions, someone could lose their job.
Thanks in advance! | 0 |
11,471,551 | 07/13/2012 13:33:25 | 1,523,686 | 07/13/2012 13:32:10 | 1 | 0 | filtering a category in dotcover | I understand that you can filter projects, classes and methods but is it possible to filter a category in dotcover.
I am using nuit as my unit tester.
Please help!
Thanks
Pete | nunit | filtering | category | dotcover | null | null | open | filtering a category in dotcover
===
I understand that you can filter projects, classes and methods but is it possible to filter a category in dotcover.
I am using nuit as my unit tester.
Please help!
Thanks
Pete | 0 |
11,471,513 | 07/13/2012 13:31:08 | 1,478,864 | 06/25/2012 01:54:32 | 23 | 0 | How to send a file AND other POST data with Synapse | **Delphi used:** 2007.
Hello,
I have a simple web page with two text input and one file input. Now, for the form to be sent, both the text inputs and the file input have to be filled. With Synapse, I know how to upload a file (*HttpPostFile*) and how to post data (*HttpMethod*). However, I don't know how to do both.
After looking at the source code of Synapse, I guess I have to "format" my data with boundaries or something like that. I guess I should have one boundary for my input file another boundary for my "normal" POST data. I found an article on the subject, but it's about sending email attachments. I tried to reproduce what they said with Synapse, with no results.
Code for *HttpPostFile*:
function HttpPostFile(const URL, FieldName, FileName: string;
const Data: TStream; const ResultData: TStrings): Boolean;
var
HTTP: THTTPSend;
Bound, s: string;
begin
Bound := IntToHex(Random(MaxInt), 8) + '_Synapse_boundary';
HTTP := THTTPSend.Create;
try
s := '--' + Bound + CRLF;
s := s + 'content-disposition: form-data; name="' + FieldName + '";';
s := s + ' filename="' + FileName +'"' + CRLF;
s := s + 'Content-Type: Application/octet-string' + CRLF + CRLF;
WriteStrToStream(HTTP.Document, s);
HTTP.Document.CopyFrom(Data, 0);
s := CRLF + '--' + Bound + '--' + CRLF;
WriteStrToStream(HTTP.Document, s);
HTTP.MimeType := 'multipart/form-data; boundary=' + Bound;
Result := HTTP.HTTPMethod('POST', URL);
if Result then
ResultData.LoadFromStream(HTTP.Document);
finally
HTTP.Free;
end;
end;
Thank you. | delphi | file | http | post | synapse | null | open | How to send a file AND other POST data with Synapse
===
**Delphi used:** 2007.
Hello,
I have a simple web page with two text input and one file input. Now, for the form to be sent, both the text inputs and the file input have to be filled. With Synapse, I know how to upload a file (*HttpPostFile*) and how to post data (*HttpMethod*). However, I don't know how to do both.
After looking at the source code of Synapse, I guess I have to "format" my data with boundaries or something like that. I guess I should have one boundary for my input file another boundary for my "normal" POST data. I found an article on the subject, but it's about sending email attachments. I tried to reproduce what they said with Synapse, with no results.
Code for *HttpPostFile*:
function HttpPostFile(const URL, FieldName, FileName: string;
const Data: TStream; const ResultData: TStrings): Boolean;
var
HTTP: THTTPSend;
Bound, s: string;
begin
Bound := IntToHex(Random(MaxInt), 8) + '_Synapse_boundary';
HTTP := THTTPSend.Create;
try
s := '--' + Bound + CRLF;
s := s + 'content-disposition: form-data; name="' + FieldName + '";';
s := s + ' filename="' + FileName +'"' + CRLF;
s := s + 'Content-Type: Application/octet-string' + CRLF + CRLF;
WriteStrToStream(HTTP.Document, s);
HTTP.Document.CopyFrom(Data, 0);
s := CRLF + '--' + Bound + '--' + CRLF;
WriteStrToStream(HTTP.Document, s);
HTTP.MimeType := 'multipart/form-data; boundary=' + Bound;
Result := HTTP.HTTPMethod('POST', URL);
if Result then
ResultData.LoadFromStream(HTTP.Document);
finally
HTTP.Free;
end;
end;
Thank you. | 0 |
11,471,514 | 07/13/2012 13:31:15 | 1,523,613 | 07/13/2012 13:00:26 | 1 | 0 | Server Side Custom data annotation MVC 3 | I have been trying to make an EmailAddress custom data annotation attribute properly validate emails, and it doesn't seem to be working for me.
Here's the test:
[Test]
public void ModelStateValidation()
{
SubscriptionController controller = new SubscriptionController();
var invalidEmails = new[] { "testtestcom", "test@testcom", "testtest.com" };
var validEmail = "[email protected]";
//Invalid Email addresses
foreach (var invalidEmail in invalidEmails)
{
var subscription = new SubscriberModel() { FirstName = "f", LastName = "l", Email = invalidEmail, ConfirmEmail = invalidEmail, DateSubscribed = DateTime.Now };
controller.ValidateModel(subscription);
Assert.That(controller.ModelState.IsValid, Is.False);
}
}
Here's the ValidateModel method:
<!-- language: c# -->
public static void ValidateModel<T>(this Controller controller, T model)
{
var validationContext = new ValidationContext(model, null, null);
var validationResults = new List<ValidationResult>();
Validator.TryValidateObject(model, validationContext, validationResults);
foreach (var validationResult in validationResults)
{
controller.ModelState.AddModelError(validationResult.MemberNames.First(), validationResult.ErrorMessage);
}
}
Model:
<!-- language: c# -->
public partial class SubscriberModel
{
public int SubscriberID { get; set; }
[Required]
[DisplayName("First Name")]
public string FirstName { get; set; }
[Required]
[DisplayName("Last Name")]
public string LastName { get; set; }
[Required]
[EmailAddress]
[Compare("ConfirmEmail", ErrorMessage = "The emails must match")]
[DisplayName("E-mail")]
public string Email { get; set; }
[Required]
[DisplayName("Confirm E-mail")]
public string ConfirmEmail { get; set; }
[Required]
[DisplayName("Date Subscribed")]
public DateTime DateSubscribed { get; set; }
}
Controller:
public partial class SubscriptionController : Controller
{
public ActionResult Index()
{
return View();
}
[CaptchaValidator]
[HttpPost]
public ActionResult Index(SubscriberModel subscription, bool captchaValid)
{
subscription.DateSubscribed = DateTime.Now;
ModelStateValid = ModelState.IsValid;
if(captchaValid)
{
if (ModelState.IsValid)
{
var test = "";
}
}
return View(subscription);
}
}
EmailAttribute class:
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
public sealed class EmailAddressAttribute : ValidationAttribute, IClientValidatable
{
private static Regex _regex = new Regex(@"^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
public EmailAddressAttribute()
: base()
{
ErrorMessage = "Invalid Email";
}
public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context) {
yield return new ModelClientValidationRule {
ValidationType = "email",
ErrorMessage = FormatErrorMessage(metadata.GetDisplayName())
};
}
public override bool IsValid(object value)
{
if (value == null) {
return false;
}
string valueAsString = value as string;
return _regex.Match(valueAsString).Success;
}
}
The IsValid method seems to validate properly, but for some reason when I go to run the unit test on the Controller.ValidateModel it doesn't return false and match my Assertion. | c# | asp.net-mvc-3 | email-validation | null | null | null | open | Server Side Custom data annotation MVC 3
===
I have been trying to make an EmailAddress custom data annotation attribute properly validate emails, and it doesn't seem to be working for me.
Here's the test:
[Test]
public void ModelStateValidation()
{
SubscriptionController controller = new SubscriptionController();
var invalidEmails = new[] { "testtestcom", "test@testcom", "testtest.com" };
var validEmail = "[email protected]";
//Invalid Email addresses
foreach (var invalidEmail in invalidEmails)
{
var subscription = new SubscriberModel() { FirstName = "f", LastName = "l", Email = invalidEmail, ConfirmEmail = invalidEmail, DateSubscribed = DateTime.Now };
controller.ValidateModel(subscription);
Assert.That(controller.ModelState.IsValid, Is.False);
}
}
Here's the ValidateModel method:
<!-- language: c# -->
public static void ValidateModel<T>(this Controller controller, T model)
{
var validationContext = new ValidationContext(model, null, null);
var validationResults = new List<ValidationResult>();
Validator.TryValidateObject(model, validationContext, validationResults);
foreach (var validationResult in validationResults)
{
controller.ModelState.AddModelError(validationResult.MemberNames.First(), validationResult.ErrorMessage);
}
}
Model:
<!-- language: c# -->
public partial class SubscriberModel
{
public int SubscriberID { get; set; }
[Required]
[DisplayName("First Name")]
public string FirstName { get; set; }
[Required]
[DisplayName("Last Name")]
public string LastName { get; set; }
[Required]
[EmailAddress]
[Compare("ConfirmEmail", ErrorMessage = "The emails must match")]
[DisplayName("E-mail")]
public string Email { get; set; }
[Required]
[DisplayName("Confirm E-mail")]
public string ConfirmEmail { get; set; }
[Required]
[DisplayName("Date Subscribed")]
public DateTime DateSubscribed { get; set; }
}
Controller:
public partial class SubscriptionController : Controller
{
public ActionResult Index()
{
return View();
}
[CaptchaValidator]
[HttpPost]
public ActionResult Index(SubscriberModel subscription, bool captchaValid)
{
subscription.DateSubscribed = DateTime.Now;
ModelStateValid = ModelState.IsValid;
if(captchaValid)
{
if (ModelState.IsValid)
{
var test = "";
}
}
return View(subscription);
}
}
EmailAttribute class:
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
public sealed class EmailAddressAttribute : ValidationAttribute, IClientValidatable
{
private static Regex _regex = new Regex(@"^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
public EmailAddressAttribute()
: base()
{
ErrorMessage = "Invalid Email";
}
public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context) {
yield return new ModelClientValidationRule {
ValidationType = "email",
ErrorMessage = FormatErrorMessage(metadata.GetDisplayName())
};
}
public override bool IsValid(object value)
{
if (value == null) {
return false;
}
string valueAsString = value as string;
return _regex.Match(valueAsString).Success;
}
}
The IsValid method seems to validate properly, but for some reason when I go to run the unit test on the Controller.ValidateModel it doesn't return false and match my Assertion. | 0 |
11,326,904 | 07/04/2012 10:07:38 | 726,221 | 04/26/2011 22:17:47 | 154 | 2 | Rails - Self referencing calculation model | I currently have a calculation structure in my rails app that has models <code>metric</code>, <code>operand</code> and <code>operation_type</code>.
Presently, the <code>metric</code> model has many <code>operands</code>, and can perform calculations based on the <code>operation_type</code> (e.g. sum, multiply, etc.), and each <code>operand</code> is defined as being right or left (i.e. so that if the operation is division, the numerator and denominator can be identified).
Presently, an operand is always an attribute of some model, e.g. <code>@customer.sales.selling_price.sum</code>.
In order to make this scalable, in need to allow an operand to be _either_ an attribute of some kind, or the results of a previous operation, i.e. an operand can be a metric.
I have included a diagram of how my models currently look:
![enter image description here][1]
Can anyone assist me with the most elegant way of allowing an operand to be an actual operand, or another metric?
Thanks!
[1]: http://i.stack.imgur.com/V8EEf.png | ruby-on-rails | database | ruby-on-rails-3 | mvc | model | null | open | Rails - Self referencing calculation model
===
I currently have a calculation structure in my rails app that has models <code>metric</code>, <code>operand</code> and <code>operation_type</code>.
Presently, the <code>metric</code> model has many <code>operands</code>, and can perform calculations based on the <code>operation_type</code> (e.g. sum, multiply, etc.), and each <code>operand</code> is defined as being right or left (i.e. so that if the operation is division, the numerator and denominator can be identified).
Presently, an operand is always an attribute of some model, e.g. <code>@customer.sales.selling_price.sum</code>.
In order to make this scalable, in need to allow an operand to be _either_ an attribute of some kind, or the results of a previous operation, i.e. an operand can be a metric.
I have included a diagram of how my models currently look:
![enter image description here][1]
Can anyone assist me with the most elegant way of allowing an operand to be an actual operand, or another metric?
Thanks!
[1]: http://i.stack.imgur.com/V8EEf.png | 0 |
11,298,161 | 07/02/2012 17:13:12 | 1,063,036 | 11/24/2011 01:27:02 | 75 | 0 | How to get html source code of a page using C#? | I'm building an application in C# to retrieve information from my bank account. So far, I'm able to connect to my bank account on https://accesd.desjardins.com. I first enter my card number and than my password on another page. Like this :
private void newweb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
switch (iStages)
{
case 1:
newweb.Document.GetElementById("card_num").SetAttribute("value", strCardNum);
newweb.Document.GetElementById("ch_but_logon").InvokeMember("click");
iStages = 2;
break;
case 2:
newweb.Document.GetElementById("passwd").SetAttribute("value", psswd);
newweb.Document.GetElementById("ch_but_logon").InvokeMember("click");
iStages = 3;
break;
}
}
But once I'm on my bank account page, I can't no longer use newweb.Document.GetElementById(..) to retrieve any html tags or elements. I want to get my total amount of money. But when I try to get any elements of the page, I always get a null element. When I tried to get the html source code of the page on Chrome, I got a html source code of a page saying that I do not have the permission to see the source code of the page (which is the one with my bank account). I was wondering how to get the source code by any means with C#. There is certainly a way of doing it, since the browser can show the web page. It must have read the source code in order to display it...
Thanks | c# | html | source | retrieve | null | null | open | How to get html source code of a page using C#?
===
I'm building an application in C# to retrieve information from my bank account. So far, I'm able to connect to my bank account on https://accesd.desjardins.com. I first enter my card number and than my password on another page. Like this :
private void newweb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
switch (iStages)
{
case 1:
newweb.Document.GetElementById("card_num").SetAttribute("value", strCardNum);
newweb.Document.GetElementById("ch_but_logon").InvokeMember("click");
iStages = 2;
break;
case 2:
newweb.Document.GetElementById("passwd").SetAttribute("value", psswd);
newweb.Document.GetElementById("ch_but_logon").InvokeMember("click");
iStages = 3;
break;
}
}
But once I'm on my bank account page, I can't no longer use newweb.Document.GetElementById(..) to retrieve any html tags or elements. I want to get my total amount of money. But when I try to get any elements of the page, I always get a null element. When I tried to get the html source code of the page on Chrome, I got a html source code of a page saying that I do not have the permission to see the source code of the page (which is the one with my bank account). I was wondering how to get the source code by any means with C#. There is certainly a way of doing it, since the browser can show the web page. It must have read the source code in order to display it...
Thanks | 0 |
11,298,166 | 07/02/2012 17:13:28 | 1,068,800 | 11/28/2011 06:22:16 | 33 | 2 | Access website running in IIS server from Remote machine | Please help me out regarding this. I am running a website in my IIS 7 server, I am able to access it from local. But I am not able to access it from remote machine. I have gone through some forums and set permission in my windows firewall also. I am using the public IP. Same thing is working for tomcat server, but not working for IIS server. Please help me. | application | iis7 | website | null | null | null | open | Access website running in IIS server from Remote machine
===
Please help me out regarding this. I am running a website in my IIS 7 server, I am able to access it from local. But I am not able to access it from remote machine. I have gone through some forums and set permission in my windows firewall also. I am using the public IP. Same thing is working for tomcat server, but not working for IIS server. Please help me. | 0 |
11,298,168 | 07/02/2012 17:13:57 | 842,700 | 07/13/2011 12:51:23 | 39 | 2 | Using a Java Filter to change locale not working | I'm trying to change the Locale using a Java Filter but the following code does not work as the JSP page is still rendered in English:
public class PreferenceFilter implements Filter {
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;
Locale locale = StringUtils.parseLocaleString("fr");
res.setLocale(locale);
chain.doFilter(req, res);
}
}
I am using a Filter as there will be some further custom logic. | java | servlet-filters | null | null | null | null | open | Using a Java Filter to change locale not working
===
I'm trying to change the Locale using a Java Filter but the following code does not work as the JSP page is still rendered in English:
public class PreferenceFilter implements Filter {
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;
Locale locale = StringUtils.parseLocaleString("fr");
res.setLocale(locale);
chain.doFilter(req, res);
}
}
I am using a Filter as there will be some further custom logic. | 0 |
11,295,620 | 07/02/2012 14:25:35 | 1,210,977 | 02/15/2012 09:56:23 | 42 | 2 | DataGrid per row converter | I have an ObservableCollection that I want to display in a DataGrid.
The collection contains objects that represent intervals (Properties Name(string), Min(double) and Max(double)).
The Min and Max could be of different units (e.g. mm or %), so I would like to use different converters (e.g. to convert to % and limit the value to 100) or stringformats (e.g. to display 2 decimal places or none at all).
Is it possible to use different converters or stringformats per row in a datagrid?
Regards,
tabina
| wpf | datagrid | row | converter | null | null | open | DataGrid per row converter
===
I have an ObservableCollection that I want to display in a DataGrid.
The collection contains objects that represent intervals (Properties Name(string), Min(double) and Max(double)).
The Min and Max could be of different units (e.g. mm or %), so I would like to use different converters (e.g. to convert to % and limit the value to 100) or stringformats (e.g. to display 2 decimal places or none at all).
Is it possible to use different converters or stringformats per row in a datagrid?
Regards,
tabina
| 0 |
11,295,622 | 07/02/2012 14:25:43 | 680,441 | 03/28/2011 14:55:31 | 1,299 | 30 | Setting a pointer to null segfault | I have a struct called node as follows:
struct node {
int data;
}
stored in some structure:
struct structure {
struct node *pointer;
}
I'm trying to set pointer to NULL as follows:
struct structure *elements;
elements->pointer = NULL;
Why does this segfault? Does it actually attempt to dereference the pointer before setting it to null?
When I switch `elements` from a pointer to the actual struct and do the following:
struct structure elements;
elements.pointer = NULL;
It stops segfaulting and works. Why doesn't setting a pointer to null work?
| c | pointers | segmentation-fault | null | null | null | open | Setting a pointer to null segfault
===
I have a struct called node as follows:
struct node {
int data;
}
stored in some structure:
struct structure {
struct node *pointer;
}
I'm trying to set pointer to NULL as follows:
struct structure *elements;
elements->pointer = NULL;
Why does this segfault? Does it actually attempt to dereference the pointer before setting it to null?
When I switch `elements` from a pointer to the actual struct and do the following:
struct structure elements;
elements.pointer = NULL;
It stops segfaulting and works. Why doesn't setting a pointer to null work?
| 0 |
11,298,173 | 07/02/2012 17:14:16 | 33,633 | 11/03/2008 12:55:08 | 609 | 8 | MVCScaffoliding package throwing MethodInvocationException | I've recently upgraded my VisualStudio 2010 installation with NuGet 2.0 and it seems that this breaks the MvcScaffolding package from Hanselman and Kirkland. Whenever I attempt to build a new controller and views w/ repositories, I get a MethodInvocationError during scaffolding. Specifically, System.Management.Automation.MethodInvocationException calling "Execute" with "5" arguements. Object reference not set to an instance of an object. According to the stack trace, this is happening at the NuGet.PackageExtensions.GetFiles() method. Of course, the final statement in the stack dump is "You may need to upgrade to a newer version of MvcScaffolding", but I've determined that this is appended to the end of all the errors. I'm currently using v1.7 of the MvcScaffolding package, which is the latest. Anyone have any thoughts on why this is happening, and better yet, how to get around it? Thanks. | asp.net | mvc | nuget | mvcscaffolding | null | null | open | MVCScaffoliding package throwing MethodInvocationException
===
I've recently upgraded my VisualStudio 2010 installation with NuGet 2.0 and it seems that this breaks the MvcScaffolding package from Hanselman and Kirkland. Whenever I attempt to build a new controller and views w/ repositories, I get a MethodInvocationError during scaffolding. Specifically, System.Management.Automation.MethodInvocationException calling "Execute" with "5" arguements. Object reference not set to an instance of an object. According to the stack trace, this is happening at the NuGet.PackageExtensions.GetFiles() method. Of course, the final statement in the stack dump is "You may need to upgrade to a newer version of MvcScaffolding", but I've determined that this is appended to the end of all the errors. I'm currently using v1.7 of the MvcScaffolding package, which is the latest. Anyone have any thoughts on why this is happening, and better yet, how to get around it? Thanks. | 0 |
11,298,179 | 07/02/2012 17:14:53 | 553,406 | 12/24/2010 15:37:11 | 466 | 2 | <authorization> tag C# | I wish to block access to all non registered users,
So, wouldnt the following work?
<authorization>
<deny users="?" />
</authorization>
But, I have seen many users using the <allow> tag as well with the deny, tag. Why we need to write `<allow>` since we just deny the unwated users?
| c# | null | null | null | null | null | open | <authorization> tag C#
===
I wish to block access to all non registered users,
So, wouldnt the following work?
<authorization>
<deny users="?" />
</authorization>
But, I have seen many users using the <allow> tag as well with the deny, tag. Why we need to write `<allow>` since we just deny the unwated users?
| 0 |
11,296,006 | 07/02/2012 14:47:23 | 1,043,290 | 11/12/2011 15:55:05 | 29 | 1 | accepts_nested_attributes_for with complex association | I'm using accepts_nested_attributes_for in one of my Rails app. i have three models :album has_many :photo and each :photo has_and_belongs_to_many :tag. User can add more photo in album using paperclip and jquery.multifile.js. every thing working fine but the main problem is the hash is not properly create.
album => {:name => "", :body => "", :photos_attributes => {"tags_attributes" => {:name => "abc"}, "photo" => {"file" => "tempfile"}}}
but i need.
album => {:name => "", :body => "", :photos_attributes => "photo" => {"file" => "tempfile", "tags_attributes" => {:name => "abc"}}}}
| ruby-on-rails | null | null | null | null | null | open | accepts_nested_attributes_for with complex association
===
I'm using accepts_nested_attributes_for in one of my Rails app. i have three models :album has_many :photo and each :photo has_and_belongs_to_many :tag. User can add more photo in album using paperclip and jquery.multifile.js. every thing working fine but the main problem is the hash is not properly create.
album => {:name => "", :body => "", :photos_attributes => {"tags_attributes" => {:name => "abc"}, "photo" => {"file" => "tempfile"}}}
but i need.
album => {:name => "", :body => "", :photos_attributes => "photo" => {"file" => "tempfile", "tags_attributes" => {:name => "abc"}}}}
| 0 |
11,713,465 | 07/29/2012 22:17:23 | 1,056,328 | 11/20/2011 12:06:17 | 182 | 0 | How to get a list of functions accessible to a class function using Boost Preprocessor? | Say I have a class that inherits from 25 difrent classes. I wonder how to gain a list of function signatures that can be called on parent classes (public) and public and private for a class I am looking at? (for example for automated RPC friend class creation) | c++ | boost | c++11 | boost-preprocessor | null | null | open | How to get a list of functions accessible to a class function using Boost Preprocessor?
===
Say I have a class that inherits from 25 difrent classes. I wonder how to gain a list of function signatures that can be called on parent classes (public) and public and private for a class I am looking at? (for example for automated RPC friend class creation) | 0 |
11,713,469 | 07/29/2012 22:18:03 | 1,561,548 | 07/29/2012 21:18:00 | 1 | 0 | Filling a 2D array with randomised numbers | I have started a project trying to create a Ken Ken puzzle. If you are not sure what Ken Ken is, it is similar to Sudoku in the way that there can be no duplicated integer values in a row or column.
I am trying to fill a 2D Array with numbers from an Array List that is created for every new row. I make checks to see whether or not the number taken from the Array List does not match any numbers within its own row and column.
When I run my code I get an "Index Out Of Bounds" exception when I try removing the integer value from the list. I'm not sure why this is happening because I think I am getting the right element.
Here is my code:
`GRID_SIZE = 4;`
`grid = new int[GRID_SIZE][GRID_SIZE];`
private void populateGrid() {
for (int row = 0; row < GRID_SIZE; row ++) {
// Creates an array of values from 1 to grid size.
for (int i = 0; i <= GRID_SIZE; i++) nums.add(i);
for (int col = 0; col < GRID_SIZE; col++) {
while (nums.size() > 0) {
// Gets a random number from the Array List
int ranNum = nums.get(numGen.nextInt(GRID_SIZE));
// Checks to see if the number is placeable.
if (canPlace(ranNum, row, col)) {
// Places the number in the 2D Array
grid[row][col] = ranNum;
break;
} else {
// Removes duplicate element from the Array List.
nums.remove(ranNum);
}
}
}
}
}
private boolean canPlace(int ranNum, int row, int col) {
for (int i = 0; i < GRID_SIZE; i++) {
// Checks if the specified number is already in the row/column.
if (grid[col][i] == ranNum) return false;
if (grid[i][row] == ranNum) return false;
}
return true;
}
I have a few questions about this:
First of all, why am I getting the error that I am?
Secondly is there anything better to use than a 2D Array for the grid and the way I place my numbers?
Lastly, am I using the break correctly?
Thanks in advance for your answers. | java | arrays | random | 2d | sudoku | null | open | Filling a 2D array with randomised numbers
===
I have started a project trying to create a Ken Ken puzzle. If you are not sure what Ken Ken is, it is similar to Sudoku in the way that there can be no duplicated integer values in a row or column.
I am trying to fill a 2D Array with numbers from an Array List that is created for every new row. I make checks to see whether or not the number taken from the Array List does not match any numbers within its own row and column.
When I run my code I get an "Index Out Of Bounds" exception when I try removing the integer value from the list. I'm not sure why this is happening because I think I am getting the right element.
Here is my code:
`GRID_SIZE = 4;`
`grid = new int[GRID_SIZE][GRID_SIZE];`
private void populateGrid() {
for (int row = 0; row < GRID_SIZE; row ++) {
// Creates an array of values from 1 to grid size.
for (int i = 0; i <= GRID_SIZE; i++) nums.add(i);
for (int col = 0; col < GRID_SIZE; col++) {
while (nums.size() > 0) {
// Gets a random number from the Array List
int ranNum = nums.get(numGen.nextInt(GRID_SIZE));
// Checks to see if the number is placeable.
if (canPlace(ranNum, row, col)) {
// Places the number in the 2D Array
grid[row][col] = ranNum;
break;
} else {
// Removes duplicate element from the Array List.
nums.remove(ranNum);
}
}
}
}
}
private boolean canPlace(int ranNum, int row, int col) {
for (int i = 0; i < GRID_SIZE; i++) {
// Checks if the specified number is already in the row/column.
if (grid[col][i] == ranNum) return false;
if (grid[i][row] == ranNum) return false;
}
return true;
}
I have a few questions about this:
First of all, why am I getting the error that I am?
Secondly is there anything better to use than a 2D Array for the grid and the way I place my numbers?
Lastly, am I using the break correctly?
Thanks in advance for your answers. | 0 |
11,713,472 | 07/29/2012 22:18:45 | 408,659 | 08/02/2010 12:49:23 | 303 | 9 | What is the best way using a XML file as a source for navigation in Android (best practice)? | I am currently trying to create an e-reader app for Airbus manuals (LPC - Less Paper Cockpit). All the pages (units) are saved in single HTML files, which are no problem to display.
What gives me more problems is the navigation, as the manual structure is stored in a 1MB XML file:
<VIEW>
<ITEM>
<FOLDER>
<FOLDER>
<ITEM>
<ITEM>
</FOLDER>
<FOLDER>
<ITEM>
</FOLDER>
<ITEM>
</FOLDER>
<FOLDER>
<FOLDER>
...
As you can see, the manual structure is similar to the one of a file system. And this is my current problem.
My target is to have a ListView, which only shows always one level of the structure, in which you can navigate forth and back. But I have problems with performance and currently I don't know which is the best solution for this problem.
I already checked two approaches:
- DOM: it takes ages to load the XML and parse it... (16 seconds for a standard size manual)
- using SAX (this is pretty complex for me, as I have to parse the XML recursively)
Which is the right way in terms of performance? Do I even have to parse the XML document in advance or can I parse it each time I change the navigation level?
| android | xml | dom | navigation | sax | null | open | What is the best way using a XML file as a source for navigation in Android (best practice)?
===
I am currently trying to create an e-reader app for Airbus manuals (LPC - Less Paper Cockpit). All the pages (units) are saved in single HTML files, which are no problem to display.
What gives me more problems is the navigation, as the manual structure is stored in a 1MB XML file:
<VIEW>
<ITEM>
<FOLDER>
<FOLDER>
<ITEM>
<ITEM>
</FOLDER>
<FOLDER>
<ITEM>
</FOLDER>
<ITEM>
</FOLDER>
<FOLDER>
<FOLDER>
...
As you can see, the manual structure is similar to the one of a file system. And this is my current problem.
My target is to have a ListView, which only shows always one level of the structure, in which you can navigate forth and back. But I have problems with performance and currently I don't know which is the best solution for this problem.
I already checked two approaches:
- DOM: it takes ages to load the XML and parse it... (16 seconds for a standard size manual)
- using SAX (this is pretty complex for me, as I have to parse the XML recursively)
Which is the right way in terms of performance? Do I even have to parse the XML document in advance or can I parse it each time I change the navigation level?
| 0 |
11,713,479 | 07/29/2012 22:19:10 | 486,578 | 10/25/2010 15:03:02 | 3,258 | 5 | How to get longitude and latitude when user tap on map? | I have inside my LinearLayout <MapView> with id=test_map.
How to get longitude and latitude when user tap on map ? In which function I can read this from event ?
| android | android-mapview | android-maps | null | null | null | open | How to get longitude and latitude when user tap on map?
===
I have inside my LinearLayout <MapView> with id=test_map.
How to get longitude and latitude when user tap on map ? In which function I can read this from event ?
| 0 |
11,713,482 | 07/29/2012 22:19:57 | 1,561,596 | 07/29/2012 22:07:12 | 1 | 0 | Geocoding/Searching for the nearest state neighbor | I have data containing business addresses and their corresponding Lat/Lon Coordinates. I would like to calculate for each observation (business), the distance between it and the nearest bordering state. Is there a (free) way to do this?
Thanks!
Cy | geocoding | reverse-geocoding | geocode | nearest-neighbor | null | null | open | Geocoding/Searching for the nearest state neighbor
===
I have data containing business addresses and their corresponding Lat/Lon Coordinates. I would like to calculate for each observation (business), the distance between it and the nearest bordering state. Is there a (free) way to do this?
Thanks!
Cy | 0 |
11,713,484 | 07/29/2012 22:20:19 | 1,561,601 | 07/29/2012 22:15:29 | 1 | 0 | Are commands such as these batch files? | I am reading Michael Hartl's Ruby On Rails Tutorial, and as customary with many programming tutorials he's having me use command line commands such as
bundle install
db: migrate
bootstrap-sass.
I'm just wondering what type of commands these are. I've read a little bit on batch files, and from what I've read it seems like these would be the batch files I've read of. | ruby-on-rails | batch-file | cmd | null | null | null | open | Are commands such as these batch files?
===
I am reading Michael Hartl's Ruby On Rails Tutorial, and as customary with many programming tutorials he's having me use command line commands such as
bundle install
db: migrate
bootstrap-sass.
I'm just wondering what type of commands these are. I've read a little bit on batch files, and from what I've read it seems like these would be the batch files I've read of. | 0 |
11,713,452 | 07/29/2012 22:15:24 | 588,855 | 08/06/2010 17:52:56 | 1,678 | 11 | If I pass a value I want it "1", otherwise, I want it "0". What do you think? | I have the following C++ code (not a complete program):
#include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
std::struct Features{
int F1;
int F2;
int F3;
int F4;
};
std::int criterionFunction(Features const& features){
return -2*features.F1*features.F2+3*features.F1+5*features.F2-2*features.F1*features.F2*
features.F3+7*features.F3+4*features.F4-2*features.F1*features.F2*features.F3*
features.F4;
}
int main(){
Features feature;
std::vector<Features> listOfFeatures(4);
listOfFeatures.push_back(feature.F1);
listOfFeatures.push_back(feature.F2);
listOfFeatures.push_back(feature.F3);
listOfFeatures.push_back(feature.F4);
std::vector<int> listOfCriterion;
}
I want to pass values to `criterionFunction()`, and, in order to get the result from `return`, the passed value will have the value `1` in the function, and the value that is not passed will have the value `0`. So, for example, if I pass `F1`, it has to be substituted by `1` in the function. How can I do that?
Thanks.
| c++ | function | vector | null | null | 07/30/2012 12:16:23 | not a real question | If I pass a value I want it "1", otherwise, I want it "0". What do you think?
===
I have the following C++ code (not a complete program):
#include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
std::struct Features{
int F1;
int F2;
int F3;
int F4;
};
std::int criterionFunction(Features const& features){
return -2*features.F1*features.F2+3*features.F1+5*features.F2-2*features.F1*features.F2*
features.F3+7*features.F3+4*features.F4-2*features.F1*features.F2*features.F3*
features.F4;
}
int main(){
Features feature;
std::vector<Features> listOfFeatures(4);
listOfFeatures.push_back(feature.F1);
listOfFeatures.push_back(feature.F2);
listOfFeatures.push_back(feature.F3);
listOfFeatures.push_back(feature.F4);
std::vector<int> listOfCriterion;
}
I want to pass values to `criterionFunction()`, and, in order to get the result from `return`, the passed value will have the value `1` in the function, and the value that is not passed will have the value `0`. So, for example, if I pass `F1`, it has to be substituted by `1` in the function. How can I do that?
Thanks.
| 1 |
11,713,486 | 07/29/2012 22:20:25 | 1,539,019 | 07/19/2012 20:12:54 | 82 | 0 | Form not hidden on page load | On my site http://goo.gl/6XCNO if you scroll down to the bottom of the page you will see the contact form that is supposed to be hidden. However if you click on "contact" in the menu then on the cross to close the pop-up box, then the form does no longer appear at the bottom.
How can I make the form invisible on page loading?
Many thanks,
| javascript | jquery | css | null | null | null | open | Form not hidden on page load
===
On my site http://goo.gl/6XCNO if you scroll down to the bottom of the page you will see the contact form that is supposed to be hidden. However if you click on "contact" in the menu then on the cross to close the pop-up box, then the form does no longer appear at the bottom.
How can I make the form invisible on page loading?
Many thanks,
| 0 |
11,270,099 | 06/29/2012 23:20:20 | 32,154 | 10/28/2008 18:38:10 | 4,188 | 60 | How to load app/vendor assets in static html served out of public? | How can I use javascripts stored in `vendor/assets/javascripts/` and `app/assets/javascripts/` in a static HTML file served out of the `public/` directory?
The HTML file is a JS test runner, so I don't want to wait for the asset pipeline or anything else each time I refresh it... I had previously defined it in `app/views` with a corresponding route and controller, but refreshing it in development was around 5 seconds per page load, which is just too slow.
Also, is there a way I can prevent this HTML file from being accessible in production? | javascript | ruby-on-rails-3 | null | null | null | null | open | How to load app/vendor assets in static html served out of public?
===
How can I use javascripts stored in `vendor/assets/javascripts/` and `app/assets/javascripts/` in a static HTML file served out of the `public/` directory?
The HTML file is a JS test runner, so I don't want to wait for the asset pipeline or anything else each time I refresh it... I had previously defined it in `app/views` with a corresponding route and controller, but refreshing it in development was around 5 seconds per page load, which is just too slow.
Also, is there a way I can prevent this HTML file from being accessible in production? | 0 |
11,270,101 | 06/29/2012 23:20:37 | 1,416,881 | 05/25/2012 08:11:55 | 1 | 0 | distinct in sql | SELECT DISTINCT(CASE WHEN state=18 THEN lga ELSE 'Others' END) LGA,
COUNT(CASE WHEN choice=21 THEN choice END ) NDCH
FROM bio GROUP BY lga
This is my sql my expectation is to give me all lga that thier state=18 and if the state is not equal to 18 let them be grouped as others but i usually have more than one others. Please help. | sql | select | distinct | rows | null | null | open | distinct in sql
===
SELECT DISTINCT(CASE WHEN state=18 THEN lga ELSE 'Others' END) LGA,
COUNT(CASE WHEN choice=21 THEN choice END ) NDCH
FROM bio GROUP BY lga
This is my sql my expectation is to give me all lga that thier state=18 and if the state is not equal to 18 let them be grouped as others but i usually have more than one others. Please help. | 0 |
11,270,102 | 06/29/2012 23:20:47 | 1,492,272 | 06/29/2012 22:36:11 | 1 | 0 | mutable copy copies by reference, not value? | Apparently mutableCopy copies by reference, not value. Ie if I do this:
NSMutableArray arrayA = [arrayB mutableCopy];
then change values of arrayB, then arrayA's values will also be changed.
I think Java has a clone() method to copy by value.. is there an equivalent in objective c? | objective-c | nsmutablearray | null | null | null | null | open | mutable copy copies by reference, not value?
===
Apparently mutableCopy copies by reference, not value. Ie if I do this:
NSMutableArray arrayA = [arrayB mutableCopy];
then change values of arrayB, then arrayA's values will also be changed.
I think Java has a clone() method to copy by value.. is there an equivalent in objective c? | 0 |
11,270,105 | 06/29/2012 23:21:19 | 917,338 | 08/29/2011 07:07:19 | 116 | 9 | What continuous integration system do you recommend with TestFlight? | What continuous integration system do you recommend with TestFlight?
Jenkings, Hudson... any other, why?
Did anyone tried https://hosted-ci.com or https://www.cisimple.com/?
Thanks a lot for suggestions and ideas :)
| ios | continuous-integration | null | null | null | null | open | What continuous integration system do you recommend with TestFlight?
===
What continuous integration system do you recommend with TestFlight?
Jenkings, Hudson... any other, why?
Did anyone tried https://hosted-ci.com or https://www.cisimple.com/?
Thanks a lot for suggestions and ideas :)
| 0 |
11,270,106 | 06/29/2012 23:21:22 | 1,041,122 | 11/11/2011 05:48:05 | 85 | 19 | Handle long text in UITableViewCell | I currently try to determine the width of the text label (detailTextLabel) of an UITableViewCell and the width of the corresponding contents string.
At the end I want to add an UITableViewCellAccessoryDisclosureIndicator, if the text is too long and the three dots showing up.
Here's my code:
NSLog(@"\nlabel width:\t%f\nstring width:\t%f\n************************",
cell.detailTextLabel.frame.size.width,
[cell.detailTextLabel.text sizeWithFont:cell.detailTextLabel.font].width);
if (cell.detailTextLabel.frame.size.width > [cell.detailTextLabel.text sizeWithFont:cell.detailTextLabel.font].width) {
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
}
My problem is, the both, the string width and the text labels width are both 0.000000.
What could be the issue here? Thanks in Advance, with kind regards, Julian | uitableviewcell | nsstring | width | uilabel | uitableviewcellaccessory | null | open | Handle long text in UITableViewCell
===
I currently try to determine the width of the text label (detailTextLabel) of an UITableViewCell and the width of the corresponding contents string.
At the end I want to add an UITableViewCellAccessoryDisclosureIndicator, if the text is too long and the three dots showing up.
Here's my code:
NSLog(@"\nlabel width:\t%f\nstring width:\t%f\n************************",
cell.detailTextLabel.frame.size.width,
[cell.detailTextLabel.text sizeWithFont:cell.detailTextLabel.font].width);
if (cell.detailTextLabel.frame.size.width > [cell.detailTextLabel.text sizeWithFont:cell.detailTextLabel.font].width) {
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
}
My problem is, the both, the string width and the text labels width are both 0.000000.
What could be the issue here? Thanks in Advance, with kind regards, Julian | 0 |
11,270,107 | 06/29/2012 23:21:42 | 1,428,241 | 05/31/2012 11:14:29 | 34 | 13 | jquery ( each and eq ) usage together in switch | question 1:
i am trying to manipulate same classed div element's css with their order with eq() but i cant access the eq() value.
question 2:
tried this with switch method. is there a way to do this progress with lesser code like for loop?
[this is DEMO][1]
HTML
<div id="a" class="ele">0</div>
<div id="b" class="ele">1</div>
<div id="c" class="ele">2</div>
jQuery
$('.ele').each(function() {
var eleH = 100;
var add = 10;
$('.ele').eq(X); //trying to get value here
switch(X) {
case 0:
project.css({'height': (eleH + add) + 'px'}); // #a { height:110px}
break;
case 1:
project.css({'height': (eleH + (add*2)) + 'px'}); // #b { height:120px}
break;
case 2:
project.css({'height': (eleH + (add*3)) + 'px'}); // #c { height:130px}
break;
}
});
[1]: http://jsfiddle.net/Aw39W/3/ | jquery | for-loop | index | switch-statement | each | null | open | jquery ( each and eq ) usage together in switch
===
question 1:
i am trying to manipulate same classed div element's css with their order with eq() but i cant access the eq() value.
question 2:
tried this with switch method. is there a way to do this progress with lesser code like for loop?
[this is DEMO][1]
HTML
<div id="a" class="ele">0</div>
<div id="b" class="ele">1</div>
<div id="c" class="ele">2</div>
jQuery
$('.ele').each(function() {
var eleH = 100;
var add = 10;
$('.ele').eq(X); //trying to get value here
switch(X) {
case 0:
project.css({'height': (eleH + add) + 'px'}); // #a { height:110px}
break;
case 1:
project.css({'height': (eleH + (add*2)) + 'px'}); // #b { height:120px}
break;
case 2:
project.css({'height': (eleH + (add*3)) + 'px'}); // #c { height:130px}
break;
}
});
[1]: http://jsfiddle.net/Aw39W/3/ | 0 |
11,270,109 | 06/29/2012 23:22:00 | 1,047,726 | 11/15/2011 14:07:10 | 1 | 0 | Objective-C Blocks and Garbage Collection Enviroment | I can't found any reference about Blocks and Garbage Collection; even the "Apple Bocks Reference" doesn't mention anithing about it (just few notes).
I never developed using blocks in a GC enviroment and I would like to know how it works, what is supported and how much "automatic" is the whole process.
Thanks in adv. | objective-c | garbage-collection | objective-c-blocks | null | null | null | open | Objective-C Blocks and Garbage Collection Enviroment
===
I can't found any reference about Blocks and Garbage Collection; even the "Apple Bocks Reference" doesn't mention anithing about it (just few notes).
I never developed using blocks in a GC enviroment and I would like to know how it works, what is supported and how much "automatic" is the whole process.
Thanks in adv. | 0 |
11,270,111 | 06/29/2012 23:22:58 | 1,287,453 | 03/23/2012 03:48:39 | 30 | 0 | Create/Edit Parent and Child Form MVC | I am using C# and MVC3
I have a simple Entity Model
Entities: Orders , OrderItems
Orders have 0 or more Order Items
I want to create a single page to create an order
While on this Page I would fill in the fields that are in the Orders table (Customer, Phone, Order Number...etc)
Then there would be a grid (I am using Telerik MVC grid). I want to add OrderItems to this grid. I was thinking of having s small form above the grid with its own submit button. I can submit using ajax and refresh the grid using ajax.
At the bottom there would be a single submit button that coudl create the order and all the orderitems at once.
I can't seem to piece this enitre solution together.
| asp.net-mvc | asp.net-mvc-3 | null | null | null | null | open | Create/Edit Parent and Child Form MVC
===
I am using C# and MVC3
I have a simple Entity Model
Entities: Orders , OrderItems
Orders have 0 or more Order Items
I want to create a single page to create an order
While on this Page I would fill in the fields that are in the Orders table (Customer, Phone, Order Number...etc)
Then there would be a grid (I am using Telerik MVC grid). I want to add OrderItems to this grid. I was thinking of having s small form above the grid with its own submit button. I can submit using ajax and refresh the grid using ajax.
At the bottom there would be a single submit button that coudl create the order and all the orderitems at once.
I can't seem to piece this enitre solution together.
| 0 |
11,270,117 | 06/29/2012 23:23:14 | 321,731 | 04/20/2010 21:30:46 | 874 | 20 | How to determine who wrote what to a socket, given 2 writers? | Say one part of a program writes some stuff to a socket and another part of the **same program** reads stuff from that same socket. If an external tool writes to that very same socket, how would I differentiate who wrote what to the socket (using the part that reads it)? Would using a [named pipe][1] work?
[1]: http://en.wikipedia.org/wiki/Named_pipe | sockets | null | null | null | null | null | open | How to determine who wrote what to a socket, given 2 writers?
===
Say one part of a program writes some stuff to a socket and another part of the **same program** reads stuff from that same socket. If an external tool writes to that very same socket, how would I differentiate who wrote what to the socket (using the part that reads it)? Would using a [named pipe][1] work?
[1]: http://en.wikipedia.org/wiki/Named_pipe | 0 |
11,270,120 | 06/29/2012 23:23:44 | 1,078,026 | 12/02/2011 18:32:40 | 19 | 0 | json Problems to echo, arrays | I am working on a script, that will use steam api, and i selected to use json for the response format.
So i have used var_dump with and without jason_decode() and it appears to be ok.
But can't manage to print it out, or echo it.
Script that gets the json data
<?php
$id = $_GET['SteamId'];
$get = file_get_contents("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=API_KEY_REMOVED_FOR_SECURITY&steamids=$id",true);
$data = json_decode($get);
//var_dump($data);
echo $data->realname;
?>
So, that i get using the var_dump with json_decode is this.
object(stdClass)#1 (1) { ["response"]=> object(stdClass)#2 (1) { ["players"]=> array(1) { [0]=> object(stdClass)#3 (15) { ["steamid"]=> string(17) "76561198053511970" ["communityvisibilitystate"]=> int(3) ["profilestate"]=> int(1) ["personaname"]=> string(9) "Undefined" ["lastlogoff"]=> int(1340978067) ["profileurl"]=> string(41) "http://steamcommunity.com/id/Heisteknikk/" ["avatar"]=> string(114) "http://media.steampowered.com/steamcommunity/public/images/avatars/5c/5c75278da69102d9c8290bccd1becbb4081954cd.jpg" ["avatarmedium"]=> string(121) "http://media.steampowered.com/steamcommunity/public/images/avatars/5c/5c75278da69102d9c8290bccd1becbb4081954cd_medium.jpg" ["avatarfull"]=> string(119) "http://media.steampowered.com/steamcommunity/public/images/avatars/5c/5c75278da69102d9c8290bccd1becbb4081954cd_full.jpg" ["personastate"]=> int(1) ["realname"]=> string(7) "Andreas" ["primaryclanid"]=> string(18) "103582791430704052" ["timecreated"]=> int(1322427688) ["loccountrycode"]=> string(2) "NO" ["locstatecode"]=> string(2) "09" } } } }
And the raw data from the json.
{
"response": {
"players": [
{
"steamid": "76561198053511970",
"communityvisibilitystate": 3,
"profilestate": 1,
"personaname": "Undefined",
"lastlogoff": 1340978067,
"profileurl": "http:\/\/steamcommunity.com\/id\/Heisteknikk\/",
"avatar": "http:\/\/media.steampowered.com\/steamcommunity\/public\/images\/avatars\/5c\/5c75278da69102d9c8290bccd1becbb4081954cd.jpg",
"avatarmedium": "http:\/\/media.steampowered.com\/steamcommunity\/public\/images\/avatars\/5c\/5c75278da69102d9c8290bccd1becbb4081954cd_medium.jpg",
"avatarfull": "http:\/\/media.steampowered.com\/steamcommunity\/public\/images\/avatars\/5c\/5c75278da69102d9c8290bccd1becbb4081954cd_full.jpg",
"personastate": 1,
"realname": "Andreas",
"primaryclanid": "103582791430704052",
"timecreated": 1322427688,
"loccountrycode": "NO",
"locstatecode": "09"
}
]
}
}
I've been searching around on google about printing the json using "echo $data->realname;".
So i don't know what i did wrong, so it canno't echo the data. | php | json | null | null | null | null | open | json Problems to echo, arrays
===
I am working on a script, that will use steam api, and i selected to use json for the response format.
So i have used var_dump with and without jason_decode() and it appears to be ok.
But can't manage to print it out, or echo it.
Script that gets the json data
<?php
$id = $_GET['SteamId'];
$get = file_get_contents("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=API_KEY_REMOVED_FOR_SECURITY&steamids=$id",true);
$data = json_decode($get);
//var_dump($data);
echo $data->realname;
?>
So, that i get using the var_dump with json_decode is this.
object(stdClass)#1 (1) { ["response"]=> object(stdClass)#2 (1) { ["players"]=> array(1) { [0]=> object(stdClass)#3 (15) { ["steamid"]=> string(17) "76561198053511970" ["communityvisibilitystate"]=> int(3) ["profilestate"]=> int(1) ["personaname"]=> string(9) "Undefined" ["lastlogoff"]=> int(1340978067) ["profileurl"]=> string(41) "http://steamcommunity.com/id/Heisteknikk/" ["avatar"]=> string(114) "http://media.steampowered.com/steamcommunity/public/images/avatars/5c/5c75278da69102d9c8290bccd1becbb4081954cd.jpg" ["avatarmedium"]=> string(121) "http://media.steampowered.com/steamcommunity/public/images/avatars/5c/5c75278da69102d9c8290bccd1becbb4081954cd_medium.jpg" ["avatarfull"]=> string(119) "http://media.steampowered.com/steamcommunity/public/images/avatars/5c/5c75278da69102d9c8290bccd1becbb4081954cd_full.jpg" ["personastate"]=> int(1) ["realname"]=> string(7) "Andreas" ["primaryclanid"]=> string(18) "103582791430704052" ["timecreated"]=> int(1322427688) ["loccountrycode"]=> string(2) "NO" ["locstatecode"]=> string(2) "09" } } } }
And the raw data from the json.
{
"response": {
"players": [
{
"steamid": "76561198053511970",
"communityvisibilitystate": 3,
"profilestate": 1,
"personaname": "Undefined",
"lastlogoff": 1340978067,
"profileurl": "http:\/\/steamcommunity.com\/id\/Heisteknikk\/",
"avatar": "http:\/\/media.steampowered.com\/steamcommunity\/public\/images\/avatars\/5c\/5c75278da69102d9c8290bccd1becbb4081954cd.jpg",
"avatarmedium": "http:\/\/media.steampowered.com\/steamcommunity\/public\/images\/avatars\/5c\/5c75278da69102d9c8290bccd1becbb4081954cd_medium.jpg",
"avatarfull": "http:\/\/media.steampowered.com\/steamcommunity\/public\/images\/avatars\/5c\/5c75278da69102d9c8290bccd1becbb4081954cd_full.jpg",
"personastate": 1,
"realname": "Andreas",
"primaryclanid": "103582791430704052",
"timecreated": 1322427688,
"loccountrycode": "NO",
"locstatecode": "09"
}
]
}
}
I've been searching around on google about printing the json using "echo $data->realname;".
So i don't know what i did wrong, so it canno't echo the data. | 0 |
11,270,124 | 06/29/2012 23:24:09 | 1,363,612 | 04/29/2012 01:16:03 | 32 | 0 | Ruby symlink not working in OS X | The following script creates symlinks as expected, but the original file can never be found. Can someone tell me why? They appear to be valid symlinks because they register as aliases in OS X and `File.symlink?` returns true once they have been created.
#!/usr/bin/env ruby
case ARGV.first when 'link'
file = ARGV[1]
if !File.exist?(file)
puts "Unfortunately, \"#{file}\" was not found."
exit 0
end
bin = "/usr/local/bin/"
if !File.directory?(bin)
puts "#{bin} does not exist!"
puts "creating #{bin}..."
system "mkdir -p #{bin}"
end
if File.extname(file).empty?
if File.symlink?(bin + file)
puts "Unfortunately, \"#{bin + file}\" already exists."
exit 0
end
name = bin + file
puts "Symlinking #{file} to #{name}..."
File.symlink(file, name)
system "chmod +x #{name}"
else
name = file.split(File.extname(file))
name = bin + name.first
if File.symlink?(name)
puts "Unfortunately, \"#{name}\" already exists."
exit 0
end
puts "Symlinking #{file} to #{name}..."
File.symlink(file, name)
system "chmod +x #{name}"
end
else
puts "try: bin link <file>"
end | ruby | osx | symlink | null | null | null | open | Ruby symlink not working in OS X
===
The following script creates symlinks as expected, but the original file can never be found. Can someone tell me why? They appear to be valid symlinks because they register as aliases in OS X and `File.symlink?` returns true once they have been created.
#!/usr/bin/env ruby
case ARGV.first when 'link'
file = ARGV[1]
if !File.exist?(file)
puts "Unfortunately, \"#{file}\" was not found."
exit 0
end
bin = "/usr/local/bin/"
if !File.directory?(bin)
puts "#{bin} does not exist!"
puts "creating #{bin}..."
system "mkdir -p #{bin}"
end
if File.extname(file).empty?
if File.symlink?(bin + file)
puts "Unfortunately, \"#{bin + file}\" already exists."
exit 0
end
name = bin + file
puts "Symlinking #{file} to #{name}..."
File.symlink(file, name)
system "chmod +x #{name}"
else
name = file.split(File.extname(file))
name = bin + name.first
if File.symlink?(name)
puts "Unfortunately, \"#{name}\" already exists."
exit 0
end
puts "Symlinking #{file} to #{name}..."
File.symlink(file, name)
system "chmod +x #{name}"
end
else
puts "try: bin link <file>"
end | 0 |
11,270,127 | 06/29/2012 23:24:24 | 1,395,076 | 05/15/2012 02:48:56 | 10 | 2 | String handling in ANSI C | I would be very glad if you could help me with this.
Supose i recieve the following path
> char* path = "home/directory/file.txt"
How could I handle this string to get just file.txt's parent directory to get this
> "home/directory"
I would like to code something that worked this way
> char* _get_ParentDir(char* file_path);
and that this function would return the parent's path.
Thank you in advance for your help!
regards, | c | string | path | filesystems | null | null | open | String handling in ANSI C
===
I would be very glad if you could help me with this.
Supose i recieve the following path
> char* path = "home/directory/file.txt"
How could I handle this string to get just file.txt's parent directory to get this
> "home/directory"
I would like to code something that worked this way
> char* _get_ParentDir(char* file_path);
and that this function would return the parent's path.
Thank you in advance for your help!
regards, | 0 |
11,541,430 | 07/18/2012 12:31:53 | 543,920 | 12/15/2010 21:08:24 | 61 | 10 | Imagemagick Efficiently getting dimensions (PHP) | I need to get the size of a given text of 10 fonts and currently doing it with queryFontMetrics($draw, $text );
However this query causes very high cpu load. Is there any other way where i efficiently can get the size (width/height) of the image (using 10 different fonts) without causing this high CPU load?
Here's the currect code:
<?
$im = new Imagick();
$draw = new ImagickDraw();
$pixel = new ImagickPixel('white' );
/*** the text to write ***/
$text = $_POST["Text2Show"];
if (!empty($text)){
for ($i = 0; $i < count($fonts); $i++) {
$draw->setFont('./fonts/'.$fonts[$i]);
$draw->setFontSize( 24 );
$font_info = $im->queryFontMetrics($draw, $text );
$width = $font_info['textWidth'];
$fontsize[$i] = $width;
}
}
?>
So anyway I can optimize this?
Thanks a bunch! | php | imagemagick | null | null | null | null | open | Imagemagick Efficiently getting dimensions (PHP)
===
I need to get the size of a given text of 10 fonts and currently doing it with queryFontMetrics($draw, $text );
However this query causes very high cpu load. Is there any other way where i efficiently can get the size (width/height) of the image (using 10 different fonts) without causing this high CPU load?
Here's the currect code:
<?
$im = new Imagick();
$draw = new ImagickDraw();
$pixel = new ImagickPixel('white' );
/*** the text to write ***/
$text = $_POST["Text2Show"];
if (!empty($text)){
for ($i = 0; $i < count($fonts); $i++) {
$draw->setFont('./fonts/'.$fonts[$i]);
$draw->setFontSize( 24 );
$font_info = $im->queryFontMetrics($draw, $text );
$width = $font_info['textWidth'];
$fontsize[$i] = $width;
}
}
?>
So anyway I can optimize this?
Thanks a bunch! | 0 |
11,541,435 | 07/18/2012 12:32:10 | 1,379,255 | 05/07/2012 08:22:39 | 12 | 0 | Appcelerator Titanium background service geolocation for Android | As far as I know, Titanium only allows to run code inside a bg.js file at a specified interval.
Is it a limitation of Appcelerator Titanium?
Is there a way to execute code as long as the service is running as you can do in java or is there a module to do that?
For example, is it possible to run socket.io.client inside the Titanium Android service?
Thanks in advance for your help. | android | titanium | socket.io | appcelerator | null | null | open | Appcelerator Titanium background service geolocation for Android
===
As far as I know, Titanium only allows to run code inside a bg.js file at a specified interval.
Is it a limitation of Appcelerator Titanium?
Is there a way to execute code as long as the service is running as you can do in java or is there a module to do that?
For example, is it possible to run socket.io.client inside the Titanium Android service?
Thanks in advance for your help. | 0 |
11,541,436 | 07/18/2012 12:32:12 | 1,365,697 | 04/30/2012 11:29:36 | 122 | 0 | Meaning of prototype in javascript |
I tried to understand the meaning of prototype in javascript
I wrote short code of inheritance of reader from Person
<script>
/* Class Person. */
function Person(name) {
this.name = name;
}
Person.prototype.getName = function() {
return this.name;
}
var reader = new Person('John Smith');
alert(reader.getName());
</script>
what is the diffrerent I was delete the line of Person.prototype.getName = function() {
return this.name;
} and create it in the Person object for example
<script>
/* Class Person. */
function Person(name) {
this.name = name;
this.getName = function() { return this.name;}
}
var reader = new Person('John Smith');
alert(reader.getName());
</script>
I got the same result of getName() | javascript | null | null | null | null | null | open | Meaning of prototype in javascript
===
I tried to understand the meaning of prototype in javascript
I wrote short code of inheritance of reader from Person
<script>
/* Class Person. */
function Person(name) {
this.name = name;
}
Person.prototype.getName = function() {
return this.name;
}
var reader = new Person('John Smith');
alert(reader.getName());
</script>
what is the diffrerent I was delete the line of Person.prototype.getName = function() {
return this.name;
} and create it in the Person object for example
<script>
/* Class Person. */
function Person(name) {
this.name = name;
this.getName = function() { return this.name;}
}
var reader = new Person('John Smith');
alert(reader.getName());
</script>
I got the same result of getName() | 0 |
11,541,446 | 07/18/2012 12:32:45 | 1,521,975 | 07/12/2012 20:29:59 | 10 | 0 | Format XML from B2B into HTML on the fly | I am new to XML and I was hoping someone could point me in the right direction on this. So an order comes in from our partner company, B2B turns it into XML and gives it back to us. It would more then likely just end up in a folder somewhere on our server or maybe the mailbox. We need to render each individual XML into a nice looking packing slip. The packing slips would be identical except for the fact that the logo would need to be changed depending on what store it came from.
Any ideas? | xml | formatting | b2b | null | null | null | open | Format XML from B2B into HTML on the fly
===
I am new to XML and I was hoping someone could point me in the right direction on this. So an order comes in from our partner company, B2B turns it into XML and gives it back to us. It would more then likely just end up in a folder somewhere on our server or maybe the mailbox. We need to render each individual XML into a nice looking packing slip. The packing slips would be identical except for the fact that the logo would need to be changed depending on what store it came from.
Any ideas? | 0 |
11,541,408 | 07/18/2012 12:30:55 | 1,107,888 | 12/20/2011 13:02:22 | 48 | 0 | jQuery won,t simulate click for mailto link | In my jQueryMobile application, I am trying to click a mailto link programmatically but having no success. Here is the html code:
<section id="mensen" data-role="page">
<div data-role="content" class="content">
<a id="emailLink" href="mailto:[email protected]">This is the email link</a>
</div>
</section>
The jquery code is :
$(document).ready(function()
{
$('#emailLink').click();
})
The link functions normally and the default email client is lanuched if clicked directly but nothing happens programmtically. | jquery | null | null | null | null | null | open | jQuery won,t simulate click for mailto link
===
In my jQueryMobile application, I am trying to click a mailto link programmatically but having no success. Here is the html code:
<section id="mensen" data-role="page">
<div data-role="content" class="content">
<a id="emailLink" href="mailto:[email protected]">This is the email link</a>
</div>
</section>
The jquery code is :
$(document).ready(function()
{
$('#emailLink').click();
})
The link functions normally and the default email client is lanuched if clicked directly but nothing happens programmtically. | 0 |
11,226,623 | 06/27/2012 12:50:22 | 4,120 | 09/01/2008 20:58:46 | 10,708 | 99 | How to find which Comparator 'broke the tie' in a Guava Ordering | I use Guava's `Ordering` class to perfom sorting to pick the 'best' from a given list. It looks something like this:
// Create the Ordering, with a list of Comparators
Ordering<String> ranker = Ordering.compound(ImmutableList.of(
STRING_LENGTH,
PERCENTAGE_UPPERCASE,
NUMBER_OF_VOWELS));
// Use the ordering to find the 'best' from a list of Strings
String best = ranker.max(asList("foo", "fooz", "Bar", "AEro"));
With this `Ordering`, the String "AEro" is the best because it's the longest, joint-best with "fooz", but tiebreaks with a higher percentage of uppercase characters.
I am looking for a way to tell which `Comparator` 'broke the tie', which in this silly contrived example would be the comparator `PERCENTAGE_UPPERCASE`.
I have a workable solution, but it's not particularly elegant, and means duplicating the list of `Comparator`s. It is to use the `Ordering` to provide a sorted list (`Ordering.sortedCopy`), pulling the first two elements (range checking of course), iterating through a List of the same `Comparator`s, comparing those two elements, breaking when the `compareTo` method returns non-zero result.
Is there a neater way? | java | guava | ordering | comparator | null | null | open | How to find which Comparator 'broke the tie' in a Guava Ordering
===
I use Guava's `Ordering` class to perfom sorting to pick the 'best' from a given list. It looks something like this:
// Create the Ordering, with a list of Comparators
Ordering<String> ranker = Ordering.compound(ImmutableList.of(
STRING_LENGTH,
PERCENTAGE_UPPERCASE,
NUMBER_OF_VOWELS));
// Use the ordering to find the 'best' from a list of Strings
String best = ranker.max(asList("foo", "fooz", "Bar", "AEro"));
With this `Ordering`, the String "AEro" is the best because it's the longest, joint-best with "fooz", but tiebreaks with a higher percentage of uppercase characters.
I am looking for a way to tell which `Comparator` 'broke the tie', which in this silly contrived example would be the comparator `PERCENTAGE_UPPERCASE`.
I have a workable solution, but it's not particularly elegant, and means duplicating the list of `Comparator`s. It is to use the `Ordering` to provide a sorted list (`Ordering.sortedCopy`), pulling the first two elements (range checking of course), iterating through a List of the same `Comparator`s, comparing those two elements, breaking when the `compareTo` method returns non-zero result.
Is there a neater way? | 0 |
11,226,624 | 06/27/2012 12:50:29 | 1,351,876 | 04/23/2012 17:06:37 | 13 | 1 | Deploying concrete5 on nginx | I have a concrete5 site that works 'out of the box' in apache server. However I am having a lot of trouble running it in nginx.
The following is the nginx configuration i am using:
server {
root /home/test/public;
index index.php;
access_log /home/test/logs/access.log;
error_log /home/test/logs/error.log;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ index.php;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
# pass the PHP scripts to FastCGI server listening on unix socket
#
location ~ \.php($|/) {
fastcgi_pass unix:/tmp/phpfpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
I am able to get the homepage but am having problem with the inner pages. The inner pages display an "Access denied". Possibly the rewrite is not working, in effect I think its querying and trying to execute php files directly instead of going through the concrete dispatcher.
I am totally lost here.
Thankyou for your help, in advance. | configuration | url-rewriting | nginx | concrete5 | null | null | open | Deploying concrete5 on nginx
===
I have a concrete5 site that works 'out of the box' in apache server. However I am having a lot of trouble running it in nginx.
The following is the nginx configuration i am using:
server {
root /home/test/public;
index index.php;
access_log /home/test/logs/access.log;
error_log /home/test/logs/error.log;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ index.php;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
# pass the PHP scripts to FastCGI server listening on unix socket
#
location ~ \.php($|/) {
fastcgi_pass unix:/tmp/phpfpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
I am able to get the homepage but am having problem with the inner pages. The inner pages display an "Access denied". Possibly the rewrite is not working, in effect I think its querying and trying to execute php files directly instead of going through the concrete dispatcher.
I am totally lost here.
Thankyou for your help, in advance. | 0 |
11,226,627 | 06/27/2012 12:50:43 | 789,965 | 06/08/2011 21:57:49 | 50 | 1 | Jensen Shannon divergence in R | I am new to R and was trying to find a function which calculates JS divergence in R.
I can see that R has KLdiv for calculating KL divergence, but is there anything available for JS divergence? | r | null | null | null | null | null | open | Jensen Shannon divergence in R
===
I am new to R and was trying to find a function which calculates JS divergence in R.
I can see that R has KLdiv for calculating KL divergence, but is there anything available for JS divergence? | 0 |
11,226,637 | 06/27/2012 12:51:41 | 1,459,161 | 06/15/2012 15:47:21 | 108 | 5 | OpenFileDialog with Blender 2.62 | I'm writing an addon for Blender 2.62 using Python.
For my plugin I need to open a file, which contains the data for the plugin.
The plugin works fine, it is integrated in the GUI, but the path to the data-file is hard coded in Python...
I've searched the web but there are only solutions for older Blender versions.
Therefore my question is:
How can I use the OpenFileDialog from Blender in my Python-Script? | python | api | blender | null | null | null | open | OpenFileDialog with Blender 2.62
===
I'm writing an addon for Blender 2.62 using Python.
For my plugin I need to open a file, which contains the data for the plugin.
The plugin works fine, it is integrated in the GUI, but the path to the data-file is hard coded in Python...
I've searched the web but there are only solutions for older Blender versions.
Therefore my question is:
How can I use the OpenFileDialog from Blender in my Python-Script? | 0 |
11,224,679 | 06/27/2012 10:58:25 | 830,084 | 07/05/2011 16:21:43 | 1 | 0 | Implementation in NEON of non uniform address jumps | I need to implement the following loop in neon.
int jump=4,c[8],i; //c[8] may be declared here
int src[256],sum=0; //src[256] may be declared here
for (i = 0; i < 4; i++)
{
sum = src[ i + 0 * jump] * c[0];//1
sum += src[ i + 1 * jump] * c[1];//2
sum += src[ i + 2 * jump] * c[2];//3
sum += src[ i + 3 * jump] * c[3];//4
sum += src[ i + 4 * jump] * c[4];//5
sum += src[ i + 5 * jump] * c[5];//6
sum += src[ i + 6 * jump] * c[6];//7
sum += src[ i + 7 * jump] * c[7];//8
src += 2; //9
}
The **main optimization** will come by running the instructions numbered 1-8 in parallel using **VMLA** instruction in NEON.
1. We may do that by loading array c[8] into registers q0 and q1 and loading array src[256] into registers q2 and q3.After this we use VMLA,VADD,VPADD to get the result in the variable sum.
2. The **problem being faced** is **how to load the elements of array src** (as src[0],src[4],src[8] and so on)since the only way i know how to load an array is by [%1]! which only loads an array sequentially(as src[0],src[1],src[2] and so on).
Also **how may the pointer src be incremented by 2** in instruction 9?
| c | arm | neon | null | null | null | open | Implementation in NEON of non uniform address jumps
===
I need to implement the following loop in neon.
int jump=4,c[8],i; //c[8] may be declared here
int src[256],sum=0; //src[256] may be declared here
for (i = 0; i < 4; i++)
{
sum = src[ i + 0 * jump] * c[0];//1
sum += src[ i + 1 * jump] * c[1];//2
sum += src[ i + 2 * jump] * c[2];//3
sum += src[ i + 3 * jump] * c[3];//4
sum += src[ i + 4 * jump] * c[4];//5
sum += src[ i + 5 * jump] * c[5];//6
sum += src[ i + 6 * jump] * c[6];//7
sum += src[ i + 7 * jump] * c[7];//8
src += 2; //9
}
The **main optimization** will come by running the instructions numbered 1-8 in parallel using **VMLA** instruction in NEON.
1. We may do that by loading array c[8] into registers q0 and q1 and loading array src[256] into registers q2 and q3.After this we use VMLA,VADD,VPADD to get the result in the variable sum.
2. The **problem being faced** is **how to load the elements of array src** (as src[0],src[4],src[8] and so on)since the only way i know how to load an array is by [%1]! which only loads an array sequentially(as src[0],src[1],src[2] and so on).
Also **how may the pointer src be incremented by 2** in instruction 9?
| 0 |
11,226,642 | 06/27/2012 12:52:08 | 1,426,066 | 05/30/2012 12:56:23 | 1 | 0 | Mono-Droid Image Banding | Im having an issue with my backgrounds. I get horrible image banding when setting background images with gradients. When I set the background in my root layout I do it as follows;
android:background="@drawable/GradientImage"
I have also tried setting the background of my root layout in the code (after removing background from axml);
Window.SetFormat(Android.Graphics.Format.Rgbx8888);
Window.AddFlags(Android.Views.WindowManagerFlags.Dither);
BitmapFactory.Options options = new BitmapFactory.Options();
options.InPreferredConfig = Bitmap.Config.Argb8888;
Bitmap gradient = BitmapFactory.DecodeResource(Resources, Resource.Drawable.Background_640,options);
sv.SetBackgroundDrawable(new BitmapDrawable(gradient));
This is done in OnCreate and unfortunately does not fix the issue,
Has anyone ever came across this issue? Does anyone now how to fix this. | android | image | monodroid | null | null | null | open | Mono-Droid Image Banding
===
Im having an issue with my backgrounds. I get horrible image banding when setting background images with gradients. When I set the background in my root layout I do it as follows;
android:background="@drawable/GradientImage"
I have also tried setting the background of my root layout in the code (after removing background from axml);
Window.SetFormat(Android.Graphics.Format.Rgbx8888);
Window.AddFlags(Android.Views.WindowManagerFlags.Dither);
BitmapFactory.Options options = new BitmapFactory.Options();
options.InPreferredConfig = Bitmap.Config.Argb8888;
Bitmap gradient = BitmapFactory.DecodeResource(Resources, Resource.Drawable.Background_640,options);
sv.SetBackgroundDrawable(new BitmapDrawable(gradient));
This is done in OnCreate and unfortunately does not fix the issue,
Has anyone ever came across this issue? Does anyone now how to fix this. | 0 |
11,226,647 | 06/27/2012 12:52:40 | 1,315,332 | 04/05/2012 12:55:15 | 506 | 35 | Can multiple multiplications in a SELECT be factorized to be performed only once for all rows? | Let's say I have the following SQL query, involving floating point operations at the "AS ..." stage.
SELECT
A * B * D1 * C AS A1
A * B * D2 * C AS A2
(...)
A * B * D100 * C AS A100
FROM TableName A
where TableName has 10.000.000 rows. 2 Questions :
1 - will the **A * B * C** be actually performed 10M times ?
2 - is there a way to factorize the **A * B * C** operation for the 2 recurrent multiplications to be performed only once for the 10M rows ?
As this question is particularly interesting, I invite everybody to upvote it massively !
| sql | optimization | null | null | null | null | open | Can multiple multiplications in a SELECT be factorized to be performed only once for all rows?
===
Let's say I have the following SQL query, involving floating point operations at the "AS ..." stage.
SELECT
A * B * D1 * C AS A1
A * B * D2 * C AS A2
(...)
A * B * D100 * C AS A100
FROM TableName A
where TableName has 10.000.000 rows. 2 Questions :
1 - will the **A * B * C** be actually performed 10M times ?
2 - is there a way to factorize the **A * B * C** operation for the 2 recurrent multiplications to be performed only once for the 10M rows ?
As this question is particularly interesting, I invite everybody to upvote it massively !
| 0 |
11,226,648 | 06/27/2012 12:52:43 | 405,763 | 07/29/2010 14:03:41 | 147 | 0 | Is it possible to use selenium web driver to drive PhantomJS? | I'm going through the documentation for the Selenium Web driver, and it can drive chrome for example. I got thinking, wouldn't it be far more efficient to 'drive' PhantomJS?
Is there a way to use selenium with PhathomJS?
My intended use would be webscraping. (the sites I scrape are loaded with AJAX and lots of lovely javascript, and I'm thinking this setup could be a good replacement for the scrapy python framework that I'm currently working with)
Thanks
| javascript | selenium | web-scraping | phantomjs | null | null | open | Is it possible to use selenium web driver to drive PhantomJS?
===
I'm going through the documentation for the Selenium Web driver, and it can drive chrome for example. I got thinking, wouldn't it be far more efficient to 'drive' PhantomJS?
Is there a way to use selenium with PhathomJS?
My intended use would be webscraping. (the sites I scrape are loaded with AJAX and lots of lovely javascript, and I'm thinking this setup could be a good replacement for the scrapy python framework that I'm currently working with)
Thanks
| 0 |
11,226,381 | 06/27/2012 12:36:55 | 1,176,094 | 01/29/2012 05:33:18 | 156 | 3 | Using Timer and colour to display morse code | Hi Guys i'm trying to let my Screen blink a morse code out using timer , but no luck, can you spot any problem?
private DispatcherTimer timer;
string word = "sos";
Dictionary<string, string> Codes = new Dictionary<string, string>
{
{"a", ".- "}, {"b", "-... "}, {"c", "-.-. "}, {"d", "-.. "},
{"e", ". "}, {"f", "..-. "}, {"g", "--. "}, {"h", ".... "},
{"i", ".. "}, {"j", ".--- "}, {"k", "-.- "}, {"l", ".-.. "},
{"m", "-- "}, {"n", "-. "}, {"o", "--- "}, {"p", ".--. "},
{"q", "--.- "}, {"r", ".-. "}, {"s", "... "}, {"t", "- "},
{"u", "..- "}, {"v", "...- "}, {"w", ".-- "}, {"x", "-..- "},
{"y", "-.-- "}, {"z", "--.. "}, {"0", "-----"}, {"1", ".----"},
{"2", "..---"}, {"3", "...--"}, {"4", "....-"}, {"5", "....."},
{"6", ".----"}, {"7", "..---"}, {"8", "...--"}, {"9", "....-"}
};
public void RunMorseCode()
{
foreach (char c in word.ToCharArray())
{
string rslt = Codes[c.ToString()].Trim();
foreach (char c2 in rslt.ToCharArray())
{
if (c2 == '.')
{
StartTimer(1000);
}
else
{
StartTimer(3000);
}
}
gridHalfFront.Opacity = 1;
}
}
private void StartTimer(double inputTiming)
{
this.timer = new DispatcherTimer();
this.timer.Interval = TimeSpan.FromMilliseconds(inputTiming);
this.timer.Start();
gridHalfFront.Opacity = 0;
} | c# | windows-8 | microsoft-metro | null | null | null | open | Using Timer and colour to display morse code
===
Hi Guys i'm trying to let my Screen blink a morse code out using timer , but no luck, can you spot any problem?
private DispatcherTimer timer;
string word = "sos";
Dictionary<string, string> Codes = new Dictionary<string, string>
{
{"a", ".- "}, {"b", "-... "}, {"c", "-.-. "}, {"d", "-.. "},
{"e", ". "}, {"f", "..-. "}, {"g", "--. "}, {"h", ".... "},
{"i", ".. "}, {"j", ".--- "}, {"k", "-.- "}, {"l", ".-.. "},
{"m", "-- "}, {"n", "-. "}, {"o", "--- "}, {"p", ".--. "},
{"q", "--.- "}, {"r", ".-. "}, {"s", "... "}, {"t", "- "},
{"u", "..- "}, {"v", "...- "}, {"w", ".-- "}, {"x", "-..- "},
{"y", "-.-- "}, {"z", "--.. "}, {"0", "-----"}, {"1", ".----"},
{"2", "..---"}, {"3", "...--"}, {"4", "....-"}, {"5", "....."},
{"6", ".----"}, {"7", "..---"}, {"8", "...--"}, {"9", "....-"}
};
public void RunMorseCode()
{
foreach (char c in word.ToCharArray())
{
string rslt = Codes[c.ToString()].Trim();
foreach (char c2 in rslt.ToCharArray())
{
if (c2 == '.')
{
StartTimer(1000);
}
else
{
StartTimer(3000);
}
}
gridHalfFront.Opacity = 1;
}
}
private void StartTimer(double inputTiming)
{
this.timer = new DispatcherTimer();
this.timer.Interval = TimeSpan.FromMilliseconds(inputTiming);
this.timer.Start();
gridHalfFront.Opacity = 0;
} | 0 |
11,728,174 | 07/30/2012 19:22:28 | 787,187 | 06/07/2011 09:32:34 | 7 | 0 | Jquery scroll menu | I want a scroll menu like one in this site http://wearemanic.com/
what Technic should i use? is there any plugin out there or please suggest some key words to google.
Thankyou. | jquery | ajax | jquery-ajax | null | null | null | open | Jquery scroll menu
===
I want a scroll menu like one in this site http://wearemanic.com/
what Technic should i use? is there any plugin out there or please suggest some key words to google.
Thankyou. | 0 |
11,728,176 | 07/30/2012 19:22:38 | 1,146,425 | 01/12/2012 21:01:23 | 19 | 2 | Missing mysql.sock file. phpMyAdmin - Fedora 17 | I run Fedora 17 with "Webadmin". So I tried to use webadmin option to update upload maximum size to my MySQL database. Now, I not able to restart mysqld. I have no GUI, so when run `systemctl status mysqld.service` I gives me this message:
[root@localhost ~]# systemctl status mysqld.service
mysqld.service - MySQL database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled)
Active: failed (Result: exit-code) since Mon, 30 Jul 2012 15:08:26 -0400; 6min ago
Process: 3560 ExecStartPost=/usr/libexec/mysqld-wait-ready $MAINPID (code=exited, status=1/FAILURE)
Process: 3559 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
Process: 3542 ExecStartPre=/usr/libexec/mysqld-prepare-db-dir (code=exited, status=0/SUCCESS)
CGroup: name=systemd:/system/mysqld.service
Jul 30 15:08:23 localhost mysqld_safe[3559]: 120730 15:08:23 mysqld_safe Logging to '/var/log/mysqld.log'.
Jul 30 15:08:23 localhost mysqld_safe[3559]: 120730 15:08:23 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
or when I try to access my phpmyadmin screen i see this message:
phpMyAdmin - Error
#2002 - Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
The server is not responding (or the local server's socket is not correctly configured).
When I run in terminal `locate mysql.sock` it shows the correct path `/var/lib/mysql/mysql.sock`.
But when I run this command `ls /var/lib/mysql`, I not able to locate this file.
Please help. | mysql | linux | phpmyadmin | fedora | webmin | null | open | Missing mysql.sock file. phpMyAdmin - Fedora 17
===
I run Fedora 17 with "Webadmin". So I tried to use webadmin option to update upload maximum size to my MySQL database. Now, I not able to restart mysqld. I have no GUI, so when run `systemctl status mysqld.service` I gives me this message:
[root@localhost ~]# systemctl status mysqld.service
mysqld.service - MySQL database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled)
Active: failed (Result: exit-code) since Mon, 30 Jul 2012 15:08:26 -0400; 6min ago
Process: 3560 ExecStartPost=/usr/libexec/mysqld-wait-ready $MAINPID (code=exited, status=1/FAILURE)
Process: 3559 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
Process: 3542 ExecStartPre=/usr/libexec/mysqld-prepare-db-dir (code=exited, status=0/SUCCESS)
CGroup: name=systemd:/system/mysqld.service
Jul 30 15:08:23 localhost mysqld_safe[3559]: 120730 15:08:23 mysqld_safe Logging to '/var/log/mysqld.log'.
Jul 30 15:08:23 localhost mysqld_safe[3559]: 120730 15:08:23 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
or when I try to access my phpmyadmin screen i see this message:
phpMyAdmin - Error
#2002 - Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
The server is not responding (or the local server's socket is not correctly configured).
When I run in terminal `locate mysql.sock` it shows the correct path `/var/lib/mysql/mysql.sock`.
But when I run this command `ls /var/lib/mysql`, I not able to locate this file.
Please help. | 0 |
11,728,178 | 07/30/2012 19:22:45 | 1,124,493 | 12/31/2011 16:21:12 | 1 | 0 | Not include functionality that requires that mode to run persistently (key App plays audio) | I'm new and i searched for a answer but i found nothing so i post my first question.
I have my v 1.1 of my app (iphone) which has been rejected from Apple.
Reasons for rejection:
------------
**2.16**
**We found that your app uses a background mode but does not include functionality that requires that mode to run persistently. This behavior is not in compliance with the App Store Review Guidelines.**
**We noticed your app declares support for audio in the UIBackgroundModes key in your Info.plist, but no audible content is played when the application is in the background. While your intention may have been to provide this functionality, at the time of review, we were not able to play background audio for your app.**
**As indicated in the iOS Application Programming Guide:
"This key is intended for use by applications that provide audible content to the user while in the background, such as music-player or streaming-audio applications."
Therefore, it would be appropriate to provide audible content to the user while the app is in the background or remove the "audio" setting from the UIBackgroundModes key.**
--------------------
In the v 1.0 which has been accepted the required background mode "App audio plays" was already enable.
When i launch one sound of my app the sound is played and i when click on the lock screen the sound continues to be played in background.
In the new version (v1.1) i added the function which detects when i push the button Home of the iphone. If the button home is pressed so the sound is paused.
When i try on my device it's run correctly and without bug.
So I don't understand exactly what is the problem with my app?
In advance thanks,
Best Regards, | iphone | objective-c | null | null | null | null | open | Not include functionality that requires that mode to run persistently (key App plays audio)
===
I'm new and i searched for a answer but i found nothing so i post my first question.
I have my v 1.1 of my app (iphone) which has been rejected from Apple.
Reasons for rejection:
------------
**2.16**
**We found that your app uses a background mode but does not include functionality that requires that mode to run persistently. This behavior is not in compliance with the App Store Review Guidelines.**
**We noticed your app declares support for audio in the UIBackgroundModes key in your Info.plist, but no audible content is played when the application is in the background. While your intention may have been to provide this functionality, at the time of review, we were not able to play background audio for your app.**
**As indicated in the iOS Application Programming Guide:
"This key is intended for use by applications that provide audible content to the user while in the background, such as music-player or streaming-audio applications."
Therefore, it would be appropriate to provide audible content to the user while the app is in the background or remove the "audio" setting from the UIBackgroundModes key.**
--------------------
In the v 1.0 which has been accepted the required background mode "App audio plays" was already enable.
When i launch one sound of my app the sound is played and i when click on the lock screen the sound continues to be played in background.
In the new version (v1.1) i added the function which detects when i push the button Home of the iphone. If the button home is pressed so the sound is paused.
When i try on my device it's run correctly and without bug.
So I don't understand exactly what is the problem with my app?
In advance thanks,
Best Regards, | 0 |
11,728,180 | 07/30/2012 19:22:50 | 428,705 | 08/23/2010 18:23:20 | 3,388 | 169 | Automating package installion if not there | I have a project. Which is getting build-ed from different developers on different system.
Is there a way I can automate package installation of not found for packages like:
gcc
yacc
If not is there a way I can pre check if particular tool is installed or not. If not show a good message to user please install the package and abort like:
Seems like you have not installed gcc, g++, yacc required to build this project. Please run following command to fix this problem:
yum install gcc g++ yacc -y
or directly running those command on that system. | cmake | null | null | null | null | null | open | Automating package installion if not there
===
I have a project. Which is getting build-ed from different developers on different system.
Is there a way I can automate package installation of not found for packages like:
gcc
yacc
If not is there a way I can pre check if particular tool is installed or not. If not show a good message to user please install the package and abort like:
Seems like you have not installed gcc, g++, yacc required to build this project. Please run following command to fix this problem:
yum install gcc g++ yacc -y
or directly running those command on that system. | 0 |
11,728,183 | 07/30/2012 19:23:02 | 1,563,907 | 07/30/2012 19:10:14 | 1 | 0 | Problems with pagination [PHP & is_numeric] | how are you? I'm with a problem in pagination.
$num_por_pagina = 5;
$paginac = $_GET[paginac];
if (!$paginac) {
$paginac = 1;
}
I would like to take only integers numbers to avoid PHP / SQL injection
For example:
accessing www.mysite.com/index.php?page=3.3 or www.mysite.com/index.php?page=3,3
resulting You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '4.6, 2' at line 7
from:
acessing www.mysite.com/index.php?page=3.3 or www.mysite.com/index.php?page=3,3
resulting error, this page isn't active
thanks! | php | pagination | page | null | null | null | open | Problems with pagination [PHP & is_numeric]
===
how are you? I'm with a problem in pagination.
$num_por_pagina = 5;
$paginac = $_GET[paginac];
if (!$paginac) {
$paginac = 1;
}
I would like to take only integers numbers to avoid PHP / SQL injection
For example:
accessing www.mysite.com/index.php?page=3.3 or www.mysite.com/index.php?page=3,3
resulting You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '4.6, 2' at line 7
from:
acessing www.mysite.com/index.php?page=3.3 or www.mysite.com/index.php?page=3,3
resulting error, this page isn't active
thanks! | 0 |
11,728,184 | 07/30/2012 19:23:05 | 601,916 | 02/03/2011 16:48:59 | 84 | 3 | Orchard CMS and javascript: Number.parseInvariant | Hi I can't get certain jscript functions in Orchard. At this moment I am struggling with Number.parseInvariant function. This works fine when using a standard ASP.Net mvc3 web application, but when porting it into Orchard this function cannot be used. I think the same goes also for Sys object. My two pennies is that in ASP.net MVC another implementation of the scripting libraries is used then in Orchard.
Anyone knows how I can bypass this. Or maybe some alternatives to this specific function?
Thanks | javascript | orchardcms | null | null | null | null | open | Orchard CMS and javascript: Number.parseInvariant
===
Hi I can't get certain jscript functions in Orchard. At this moment I am struggling with Number.parseInvariant function. This works fine when using a standard ASP.Net mvc3 web application, but when porting it into Orchard this function cannot be used. I think the same goes also for Sys object. My two pennies is that in ASP.net MVC another implementation of the scripting libraries is used then in Orchard.
Anyone knows how I can bypass this. Or maybe some alternatives to this specific function?
Thanks | 0 |
11,728,185 | 07/30/2012 19:23:05 | 1,222,237 | 02/20/2012 23:33:46 | 6 | 0 | Glassfish 3.1 Remote client connecting to JMS queue in cluster | Glassfish 3.1.2
Ubuntu 12.04
I've created a cluster of two nodes and have a JMS queue.
I'm having issues trying to connect to this JMS queue using a remote standalone client.
The cluster JMS listener is on port 27676 and the queue is deployed to the cluster.
mq://Glassfish2:27676/,mq://Glassfish3:27676
When I connect using the code I'd use to connect to a stand alone instance the message is not received by the cluster.
I believe it is using the default 7676 port. When the IIOP port is changed to use port 23700 which is the one the cluster (DAS) is using I get a connection refused exception as it is trying to connect to localhost:27676. At least it's the right port.
WARNING: [C4003]: Error occurred on connection creation [localhost:27676]. - cause: java.net.ConnectException: Connection refused: connect
I've also updated the following values in node config file (domain.xml) to remove references to localhost. jms-host and node-host values.
I had this issue before with a stand alone instance and it was resolved by adding entries to the /etc/hosts file. However, this does not seem to resolve the issue.
I also have all server instance IPs in the hosts file.
Am I missing something very basic here?
Any help would be greatly appreciated.
Thanks | glassfish | jms | cluster-computing | glassfish-3 | null | null | open | Glassfish 3.1 Remote client connecting to JMS queue in cluster
===
Glassfish 3.1.2
Ubuntu 12.04
I've created a cluster of two nodes and have a JMS queue.
I'm having issues trying to connect to this JMS queue using a remote standalone client.
The cluster JMS listener is on port 27676 and the queue is deployed to the cluster.
mq://Glassfish2:27676/,mq://Glassfish3:27676
When I connect using the code I'd use to connect to a stand alone instance the message is not received by the cluster.
I believe it is using the default 7676 port. When the IIOP port is changed to use port 23700 which is the one the cluster (DAS) is using I get a connection refused exception as it is trying to connect to localhost:27676. At least it's the right port.
WARNING: [C4003]: Error occurred on connection creation [localhost:27676]. - cause: java.net.ConnectException: Connection refused: connect
I've also updated the following values in node config file (domain.xml) to remove references to localhost. jms-host and node-host values.
I had this issue before with a stand alone instance and it was resolved by adding entries to the /etc/hosts file. However, this does not seem to resolve the issue.
I also have all server instance IPs in the hosts file.
Am I missing something very basic here?
Any help would be greatly appreciated.
Thanks | 0 |
11,727,687 | 07/30/2012 18:47:36 | 1,563,804 | 07/30/2012 18:26:09 | 1 | 0 | Return fixed number of items from a directory in reverse alphabetical order | I have files in directories that are labeled by date (eg, 2012-07-05.xls, 2012-07-04.xls) and I want only to list (and link) the last 10 files in that directory, starting with the newest one. I can generate the list easily in the proper order, but can't figure out how to limit it to 10 (and also not return an "." and ".." entry for the directories).
Here's what I have now. Open to all suggestions.
<?php
$path = $_SERVER[DOCUMENT_ROOT]."/path/";
$dh = @opendir($path);
$files = array();
while (false !== ($file = readdir($dh))) {
array_push($files, $file);
}
rsort($files);
foreach ($files as $file){
echo "<li><a href=\"$file\">";
echo($file)."</a></li>";
}
?>
| opendir | null | null | null | null | null | open | Return fixed number of items from a directory in reverse alphabetical order
===
I have files in directories that are labeled by date (eg, 2012-07-05.xls, 2012-07-04.xls) and I want only to list (and link) the last 10 files in that directory, starting with the newest one. I can generate the list easily in the proper order, but can't figure out how to limit it to 10 (and also not return an "." and ".." entry for the directories).
Here's what I have now. Open to all suggestions.
<?php
$path = $_SERVER[DOCUMENT_ROOT]."/path/";
$dh = @opendir($path);
$files = array();
while (false !== ($file = readdir($dh))) {
array_push($files, $file);
}
rsort($files);
foreach ($files as $file){
echo "<li><a href=\"$file\">";
echo($file)."</a></li>";
}
?>
| 0 |
11,728,189 | 07/30/2012 19:23:26 | 289,251 | 03/08/2010 23:50:30 | 1,570 | 75 | Detecting when MapView tiles are displayed | Since `- (void)mapViewDidFinishLoadingMap:(MKMapView *)mapView` is not called when the tiles are loaded from cache, is there a way to know when all the tiles have been loaded (either from cache or from the mapping servers) and displayed? | iphone | ios | mkmapview | mkmapviewdelegate | null | null | open | Detecting when MapView tiles are displayed
===
Since `- (void)mapViewDidFinishLoadingMap:(MKMapView *)mapView` is not called when the tiles are loaded from cache, is there a way to know when all the tiles have been loaded (either from cache or from the mapping servers) and displayed? | 0 |
11,728,191 | 07/30/2012 19:23:31 | 1,522,316 | 07/13/2012 00:33:45 | 36 | 0 | How to create a function that returns smallest value of an unordered binary tree | This seems like it should be really easy but I've been having trouble with this for quite some time. As the title says, I'm just trying to find the node in a Binary tree (not a BST!) with the smallest value and return it. I can write a recursive void function pretty easily that can at least assign the smallest value in the function, but I'm getting stuck on how to back track to previous nodes once I reach a NULL pointer.
I have a node class that has a pointer to a left and right child, each with its own value. Here is my (failed) attempt so far:
int preOrder(Node *node, int value, int count, int sizeOfTree)
{
count++; //keeps track of whether or not we have traversed the whole tree
if(value < node->getValue())
value = node->getValue();
if(count == sizeOfTree);
return value;
if(node == NULL)
//Want to return to the previous function call
//How do I do this for a non void function?
//for a void function, you could jsut type "return;" and the function
//back tracks to your previous place in the tree
//but since I'm returning a value, How would I go about doing this?
//these 2 calls are incorrect but the idea is that I first traverse the left subtree
//followed by a traversal of the right subtree.
preOrder(node->getLeft(), value);
preOrder(node->getRight(), value);
}
If possible, I would like to try and do this without keeping track of a "count" as well to make the code cleaner.
Let me know if anymore clarification is needed.
Thanks for any help!
| c++ | tree | binary | traversal | null | null | open | How to create a function that returns smallest value of an unordered binary tree
===
This seems like it should be really easy but I've been having trouble with this for quite some time. As the title says, I'm just trying to find the node in a Binary tree (not a BST!) with the smallest value and return it. I can write a recursive void function pretty easily that can at least assign the smallest value in the function, but I'm getting stuck on how to back track to previous nodes once I reach a NULL pointer.
I have a node class that has a pointer to a left and right child, each with its own value. Here is my (failed) attempt so far:
int preOrder(Node *node, int value, int count, int sizeOfTree)
{
count++; //keeps track of whether or not we have traversed the whole tree
if(value < node->getValue())
value = node->getValue();
if(count == sizeOfTree);
return value;
if(node == NULL)
//Want to return to the previous function call
//How do I do this for a non void function?
//for a void function, you could jsut type "return;" and the function
//back tracks to your previous place in the tree
//but since I'm returning a value, How would I go about doing this?
//these 2 calls are incorrect but the idea is that I first traverse the left subtree
//followed by a traversal of the right subtree.
preOrder(node->getLeft(), value);
preOrder(node->getRight(), value);
}
If possible, I would like to try and do this without keeping track of a "count" as well to make the code cleaner.
Let me know if anymore clarification is needed.
Thanks for any help!
| 0 |
11,728,195 | 07/30/2012 19:23:56 | 469,408 | 10/07/2010 17:39:14 | 2,598 | 1 | Webkit GTK: Determine when a document is finished loading | There are other questions on StackOverflow which are *close* to what I want to know, like http://stackoverflow.com/questions/5724088/webkit-gtk-how-to-detect-when-a-download-has-finished, but I think I'm asking something a bit different:
In general, in the event-driven C Webkit-GTK API there are a lot of events which may relate to the idea of when some document is finished "loading". The problem is the [documentation][1] is pretty sparse, and the idea of "finished loading" isn't necessarily clear, because it can refer to a lot of things. Does "finished loading" mean that the document is finished *downloading*? That it's finished creating the DOM tree? That it's finished downloading including *all* other resources (like CSS, JS and image files?)
Relevant signals are `signal::notify::load-status`, `document-load-finished`, and `resource-load-finished`.
The `load-status` signal fires everytime the load status changes, so you need to manually call `webkit_web_view_get_load_status` and check the status each time. Even so, when the status finally is `WEBKIT_LOAD_FINISHED`, I'm not sure what that means - does it mean WebKit is done *downloading* the resource, or that it's finished creating the DOM tree, or what?
Question:
What is the difference between the various "finished" signals, and is there any signal that is equivalent to the standard Javascript DOM event `window.onload`?
[1]: http://webkitgtk.org/reference/webkitgtk/stable/webkitgtk-webkitwebview.html | c | webkit | gtk | webkitgtk | null | null | open | Webkit GTK: Determine when a document is finished loading
===
There are other questions on StackOverflow which are *close* to what I want to know, like http://stackoverflow.com/questions/5724088/webkit-gtk-how-to-detect-when-a-download-has-finished, but I think I'm asking something a bit different:
In general, in the event-driven C Webkit-GTK API there are a lot of events which may relate to the idea of when some document is finished "loading". The problem is the [documentation][1] is pretty sparse, and the idea of "finished loading" isn't necessarily clear, because it can refer to a lot of things. Does "finished loading" mean that the document is finished *downloading*? That it's finished creating the DOM tree? That it's finished downloading including *all* other resources (like CSS, JS and image files?)
Relevant signals are `signal::notify::load-status`, `document-load-finished`, and `resource-load-finished`.
The `load-status` signal fires everytime the load status changes, so you need to manually call `webkit_web_view_get_load_status` and check the status each time. Even so, when the status finally is `WEBKIT_LOAD_FINISHED`, I'm not sure what that means - does it mean WebKit is done *downloading* the resource, or that it's finished creating the DOM tree, or what?
Question:
What is the difference between the various "finished" signals, and is there any signal that is equivalent to the standard Javascript DOM event `window.onload`?
[1]: http://webkitgtk.org/reference/webkitgtk/stable/webkitgtk-webkitwebview.html | 0 |
11,728,196 | 07/30/2012 19:24:01 | 1,000,971 | 10/18/2011 11:04:41 | 125 | 6 | Play! framework. create a new view | I created a new project using the play console
now, by default I got in my views directory two files:
main.scala.html
index.scala.html
I want to add a new view file. I call it "forums.scala.html"
now, I know that in order to render a view you need to do this:
views.html.forums.render("Forums");
the problem is that the intellisense doesn't recognize "forums"
but index and main it does recognize.
I've noticed those files:
> class_managed/views.html/index.class
> class_managed/views.html/main.class
but there is no forums.class so I suspect this is the problem.
I tried to build the project, but it didn't help.
so, what is the solution?
thanks | java | web | playframework-2.0 | web-development-server | null | null | open | Play! framework. create a new view
===
I created a new project using the play console
now, by default I got in my views directory two files:
main.scala.html
index.scala.html
I want to add a new view file. I call it "forums.scala.html"
now, I know that in order to render a view you need to do this:
views.html.forums.render("Forums");
the problem is that the intellisense doesn't recognize "forums"
but index and main it does recognize.
I've noticed those files:
> class_managed/views.html/index.class
> class_managed/views.html/main.class
but there is no forums.class so I suspect this is the problem.
I tried to build the project, but it didn't help.
so, what is the solution?
thanks | 0 |
11,728,198 | 07/30/2012 19:24:03 | 1,563,922 | 07/30/2012 19:19:19 | 1 | 0 | Create an image and colored ir? | how can I create an image and how can I colored it pixel by pixel using hexadecimal code of colors?
For ex. I wanna create a 100x100 pixel image and I wanto to 1x1 area's color is '$002125',2x2 area's color is '$125487'.... How can I do it?
Thank you for your answers.. | delphi-7 | null | null | null | null | null | open | Create an image and colored ir?
===
how can I create an image and how can I colored it pixel by pixel using hexadecimal code of colors?
For ex. I wanna create a 100x100 pixel image and I wanto to 1x1 area's color is '$002125',2x2 area's color is '$125487'.... How can I do it?
Thank you for your answers.. | 0 |
11,327,398 | 07/04/2012 10:37:40 | 1,365,650 | 04/30/2012 11:01:15 | 12 | 2 | Line Joining Parent to Child Window | Ok complicated logic coming up...
So I'm trying to create an application that has a pop up window with a pointer/line coming from the child window to a particular place in the parent window. I achieved this like so;
<Border Name="brdr" Margin="40,0,0,0" >
//Content
</Border>
<Line
Name="Pointer"
X1="0"
X2="40"
Y1="55"
Y2="50"
StrokeThickness="2"
Stroke="Black"
></Line>
Notice the 40 left `Margin` on the border that makes the window larger than it appears so that the `Polygon` sticks out to the left and points to the parent window (If there's a better/cooler/more elegant way of doing this, I'm all ears).
So that worked fine but now I want the pointer to be dynamic. As in, if the child window gets dragged the pointer must scale relatively to the parent window's location. I.e. it must appear as if the two windows are attached via the line. Now my plan was to record the point the child window opens on (because it opens relative to the parent window, it's correct when it initialises) and then use the difference between this and the new location point (after dragging) to find the new points that the line should be going to. My code probably says it better than I ever could...
private void Window_LocationChanged(object sender, EventArgs e)
{
if (this.IsLoaded)
{
brdr.Margin = new Thickness(Math.Abs(this.Left - WinLeft) + 40, Math.Abs(this.Top - WinTop), 0, 0);
Pointer.X1 = Math.Abs(this.Left - WinLeft);
Pointer.Y1 = Math.Abs(this.Top - WinTop) + 55;
Pointer.X2 = Math.Abs(this.Left - WinLeft) + 40;
Pointer.Y2 = Math.Abs(this.Top - WinTop) + 50;
}
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
WinLeft = this.Left;
WinTop = this.Top;
}
As you can see I have to set the window margin so that it extends to the old position (using absolute values to make sure the window can go both right and left). Then I reset the `Line` coords to the new values. All these values are calculated, like I said, by comparing the opening window coords to the current coords.
My problem is, this isn't right. Would be very impressed to see someone able to figure this out. | c# | wpf | math | coordinates | parent-child | null | open | Line Joining Parent to Child Window
===
Ok complicated logic coming up...
So I'm trying to create an application that has a pop up window with a pointer/line coming from the child window to a particular place in the parent window. I achieved this like so;
<Border Name="brdr" Margin="40,0,0,0" >
//Content
</Border>
<Line
Name="Pointer"
X1="0"
X2="40"
Y1="55"
Y2="50"
StrokeThickness="2"
Stroke="Black"
></Line>
Notice the 40 left `Margin` on the border that makes the window larger than it appears so that the `Polygon` sticks out to the left and points to the parent window (If there's a better/cooler/more elegant way of doing this, I'm all ears).
So that worked fine but now I want the pointer to be dynamic. As in, if the child window gets dragged the pointer must scale relatively to the parent window's location. I.e. it must appear as if the two windows are attached via the line. Now my plan was to record the point the child window opens on (because it opens relative to the parent window, it's correct when it initialises) and then use the difference between this and the new location point (after dragging) to find the new points that the line should be going to. My code probably says it better than I ever could...
private void Window_LocationChanged(object sender, EventArgs e)
{
if (this.IsLoaded)
{
brdr.Margin = new Thickness(Math.Abs(this.Left - WinLeft) + 40, Math.Abs(this.Top - WinTop), 0, 0);
Pointer.X1 = Math.Abs(this.Left - WinLeft);
Pointer.Y1 = Math.Abs(this.Top - WinTop) + 55;
Pointer.X2 = Math.Abs(this.Left - WinLeft) + 40;
Pointer.Y2 = Math.Abs(this.Top - WinTop) + 50;
}
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
WinLeft = this.Left;
WinTop = this.Top;
}
As you can see I have to set the window margin so that it extends to the old position (using absolute values to make sure the window can go both right and left). Then I reset the `Line` coords to the new values. All these values are calculated, like I said, by comparing the opening window coords to the current coords.
My problem is, this isn't right. Would be very impressed to see someone able to figure this out. | 0 |
11,327,114 | 07/04/2012 10:19:21 | 256,890 | 05/25/2009 13:31:32 | 615 | 6 | Character style influenced by background while painting it with Graphics.DrawString() (.NET 4.0) | Background: I am working on a legacy map application using WinForms and .NET4.0. The labels, roads, icons are painted to a separate bitmap called "overlay" apart from the terrain. The background of the overlay is transparent and later will be painted over the terrain bitmap.
**The problem is that while painting the text on the bitmap, the text style is being influenced by bitmap background.** I show you an example picture of the overlay:
![enter image description here][1]
[1]: http://i.stack.imgur.com/ucBy3.png
Take a look at the label "abbey" and "white". "White" has been painted on completely transparent background and now looks like if it were written in bold. While "ab" in the "abbey" looks regular text as it has been painted over the icon.
Here is the code that produces the label:
var labelRectangle = GetLabelBorders();
Color labelBackgroundColor = Color.FromArgb(128, Color.FromName("LightPink"));
SolidBrush sb = new SolidBrush(labelBackgroundColor);
graphics.FillRectangle(sb, labelRectangle );
graphics.DrawRectangle(WhitePen, labelRectangle .X, labelRectangle .Y,
labelRectangle .Width - 1, labelRectangle .Height - 1);
Font timesnew8 = new Font("TimesNew", 8);
StringFormat strForm = new StringFormat();
strForm.Alignment = StringAlignment.Near;
graphics.DrawString("abbey", timesnew8, Brushes.Black, labelRectangle , strForm);
**I want the text not-bold looking. How can I do that?**
| .net | winforms | graphics | gdi | drawstring | null | open | Character style influenced by background while painting it with Graphics.DrawString() (.NET 4.0)
===
Background: I am working on a legacy map application using WinForms and .NET4.0. The labels, roads, icons are painted to a separate bitmap called "overlay" apart from the terrain. The background of the overlay is transparent and later will be painted over the terrain bitmap.
**The problem is that while painting the text on the bitmap, the text style is being influenced by bitmap background.** I show you an example picture of the overlay:
![enter image description here][1]
[1]: http://i.stack.imgur.com/ucBy3.png
Take a look at the label "abbey" and "white". "White" has been painted on completely transparent background and now looks like if it were written in bold. While "ab" in the "abbey" looks regular text as it has been painted over the icon.
Here is the code that produces the label:
var labelRectangle = GetLabelBorders();
Color labelBackgroundColor = Color.FromArgb(128, Color.FromName("LightPink"));
SolidBrush sb = new SolidBrush(labelBackgroundColor);
graphics.FillRectangle(sb, labelRectangle );
graphics.DrawRectangle(WhitePen, labelRectangle .X, labelRectangle .Y,
labelRectangle .Width - 1, labelRectangle .Height - 1);
Font timesnew8 = new Font("TimesNew", 8);
StringFormat strForm = new StringFormat();
strForm.Alignment = StringAlignment.Near;
graphics.DrawString("abbey", timesnew8, Brushes.Black, labelRectangle , strForm);
**I want the text not-bold looking. How can I do that?**
| 0 |
11,327,401 | 07/04/2012 10:37:56 | 1,463,275 | 06/18/2012 09:39:09 | 8 | 0 | Hibernate Select and Then delete | excuse me, i know that :
Query query = session.createQuery("delete from Class where id = 5");
query.executeUpdate();
will delete the record with id = 5 but before i delete it, i need to save some information from it.
so i want to select id = 5, and after some code, i delete it.
i think it's not good to code like :
query = session.createQuery("from Class where id = 5");
//somecode
query = session.createQuery("delete Class where id = 5");
...
so, what is the right way?
| java | mysql | database | hibernate | java-ee | null | open | Hibernate Select and Then delete
===
excuse me, i know that :
Query query = session.createQuery("delete from Class where id = 5");
query.executeUpdate();
will delete the record with id = 5 but before i delete it, i need to save some information from it.
so i want to select id = 5, and after some code, i delete it.
i think it's not good to code like :
query = session.createQuery("from Class where id = 5");
//somecode
query = session.createQuery("delete Class where id = 5");
...
so, what is the right way?
| 0 |
11,327,402 | 07/04/2012 10:38:00 | 706,780 | 04/13/2011 20:29:31 | 3,263 | 145 | create package folders in shell | I have something like this
package="com.program.interesting.program.aplication"
I want script that will create foleders like this
midir com
cd com/
mkdir program
cd program/
...
and so on, but I want to do this automatically , no mater of the size of the number of folders
I guess this is very simple , but I do not know how parse string in shell
and I do not want to read book just to solve this
thanks
| linux | shell | script | null | null | null | open | create package folders in shell
===
I have something like this
package="com.program.interesting.program.aplication"
I want script that will create foleders like this
midir com
cd com/
mkdir program
cd program/
...
and so on, but I want to do this automatically , no mater of the size of the number of folders
I guess this is very simple , but I do not know how parse string in shell
and I do not want to read book just to solve this
thanks
| 0 |
11,327,403 | 07/04/2012 10:38:05 | 223,842 | 12/03/2009 13:28:27 | 320 | 8 | Call my own function with a pointer of some kind | I have numerous functions that are called from a background thread, but then need to perform a GUI operation. Therefore in each function, I switch context to the GUI thread. However I'm wondering if my code can be improved?
Here's a cut down example of how my code typically looks now:
public void FunctionABC(string test)
{
// Make sure we are in the GUI thread.
if (!this.Dispatcher.CheckAccess())
{
this.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => FunctionABC(test))); return;
}
// main body of function
}
The main part I have a problem with is having to mention my own function name explicitly in the context switch (I partly dislike this because I keep forgetting to change the name when I copy and paste the code!)
Any ideas for a more generic way of switching context, e.g. is any way of calling back into my own function via some clever pointer that avoids naming the function explicitly?
Something like this snippet would be good (which doesn't build however):
this.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => this(test))); return;
Thoughts?
| c# | multithreading | null | null | null | null | open | Call my own function with a pointer of some kind
===
I have numerous functions that are called from a background thread, but then need to perform a GUI operation. Therefore in each function, I switch context to the GUI thread. However I'm wondering if my code can be improved?
Here's a cut down example of how my code typically looks now:
public void FunctionABC(string test)
{
// Make sure we are in the GUI thread.
if (!this.Dispatcher.CheckAccess())
{
this.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => FunctionABC(test))); return;
}
// main body of function
}
The main part I have a problem with is having to mention my own function name explicitly in the context switch (I partly dislike this because I keep forgetting to change the name when I copy and paste the code!)
Any ideas for a more generic way of switching context, e.g. is any way of calling back into my own function via some clever pointer that avoids naming the function explicitly?
Something like this snippet would be good (which doesn't build however):
this.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => this(test))); return;
Thoughts?
| 0 |
11,327,404 | 07/04/2012 10:38:06 | 480,391 | 09/16/2010 11:20:02 | 648 | 42 | Deriving from Exception classes warning: CA2237: Mark ISerializable types with SerializableAttribute | I derived several classes from various exceptions. Now vs gives warning as in the title of this question.
1.Could someone explain what implications of suppressing this rule?
2.Could you explain rule from [here][1] saying "Do not suppress a warning from this rule for exception classes because they must be serializable to work correctly across application domains."?
Thanks.
[1]: http://msdn.microsoft.com/query/dev11.query?appId=Dev11IDEF1&l=EN-US&k=k(CA2237)&rd=true | net | null | null | null | null | null | open | Deriving from Exception classes warning: CA2237: Mark ISerializable types with SerializableAttribute
===
I derived several classes from various exceptions. Now vs gives warning as in the title of this question.
1.Could someone explain what implications of suppressing this rule?
2.Could you explain rule from [here][1] saying "Do not suppress a warning from this rule for exception classes because they must be serializable to work correctly across application domains."?
Thanks.
[1]: http://msdn.microsoft.com/query/dev11.query?appId=Dev11IDEF1&l=EN-US&k=k(CA2237)&rd=true | 0 |
11,327,405 | 07/04/2012 10:38:12 | 504,612 | 11/11/2010 14:22:11 | 606 | 14 | CSS absolute positioning dialema | I'm very experienced with CSS but this one has me confused - apologies if it is a simple fix.
**I am attempting to theme a Drupal webform which has multiple fieldsets. The idea is to stack the fieldsets on top of each other. A fairly simple CSS issue of positioning relatively and absolutely - but it goes very wrong as the containing div collapses instead of maintaining it's shape.**
You can see the problem at **http://164.177.146.240/eventbooking5/node/6**. I set the background-color of the fieldsets to green.
The containing border has a red border and is positioned relatively.
**When the fieldsets are positioned absolutely, they stack as I expect but the containing DIV collapses and compromises the rest of the sites styling**
I really would appreciate some help.
| css | positioning | null | null | null | null | open | CSS absolute positioning dialema
===
I'm very experienced with CSS but this one has me confused - apologies if it is a simple fix.
**I am attempting to theme a Drupal webform which has multiple fieldsets. The idea is to stack the fieldsets on top of each other. A fairly simple CSS issue of positioning relatively and absolutely - but it goes very wrong as the containing div collapses instead of maintaining it's shape.**
You can see the problem at **http://164.177.146.240/eventbooking5/node/6**. I set the background-color of the fieldsets to green.
The containing border has a red border and is positioned relatively.
**When the fieldsets are positioned absolutely, they stack as I expect but the containing DIV collapses and compromises the rest of the sites styling**
I really would appreciate some help.
| 0 |
11,327,406 | 07/04/2012 10:38:16 | 1,258,754 | 03/09/2012 07:16:59 | 1 | 0 | DB2 LoginUser creation trough query | Can anybody tell me the query to create LOGIN USER in DB2_9.5, I want to create it it by firing query from command editor? | db2 | null | null | null | null | null | open | DB2 LoginUser creation trough query
===
Can anybody tell me the query to create LOGIN USER in DB2_9.5, I want to create it it by firing query from command editor? | 0 |
11,327,407 | 07/04/2012 10:38:33 | 1,409,328 | 05/22/2012 04:53:08 | 22 | 1 | Don't dismiss the alert dialog until user input text in editext | I am making an alert dialog with edit text. I want that it will remain on screen until user input his email in it. How can I do that?? My code is as below:
final AlertDialog.Builder alert= new AlertDialog.Builder(this);
alert.setMessage("Enter Email:");
final EditText userid = new EditText(this);
alert.setView(userid);
userid.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
if (userid.getText().toString().length()>0){
userId = userid.getText().toString();
result();
}else{
Toast.makeText(getApplicationContext(), "Enter your email for future reference.", Toast.LENGTH_SHORT).show();
}
}
});
alert.show();
by clicking on any button the dialog dismisses. Please do tell how to retain the dailog on screen till i need it.Thanx in advance... | android | edittext | android-alertdialog | null | null | null | open | Don't dismiss the alert dialog until user input text in editext
===
I am making an alert dialog with edit text. I want that it will remain on screen until user input his email in it. How can I do that?? My code is as below:
final AlertDialog.Builder alert= new AlertDialog.Builder(this);
alert.setMessage("Enter Email:");
final EditText userid = new EditText(this);
alert.setView(userid);
userid.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
if (userid.getText().toString().length()>0){
userId = userid.getText().toString();
result();
}else{
Toast.makeText(getApplicationContext(), "Enter your email for future reference.", Toast.LENGTH_SHORT).show();
}
}
});
alert.show();
by clicking on any button the dialog dismisses. Please do tell how to retain the dailog on screen till i need it.Thanx in advance... | 0 |
11,327,409 | 07/04/2012 10:38:38 | 1,476,676 | 06/23/2012 10:41:38 | 13 | 0 | php make link from mysql results | How can i make the $row['Fname'] to be a link and when i click it, redirect me to a new page with more info about this entry i clicked?
here is the code:
echo '<ol>';
while ($row = mysql_fetch_array($sql)){
echo '<li>';
echo '<img src="'.$row['Bio']. '" alt="" width="110" height="110">';
echo ' <dl>';
echo ' <dt>Name</dt>';
echo ' <dd>'.$row['Fname'].'</dd>';
echo ' <dt>Genre</dt>';
echo ' <dd>'.$row['Genre'].'</dd>';
echo ' <dt>Speciality</dt>';
echo ' <dd>'.$row['Specialty'].'</dd>';
echo ' </dl>';
echo '</li>';
}
echo '</ol>'; | php | mysql | echo | null | null | null | open | php make link from mysql results
===
How can i make the $row['Fname'] to be a link and when i click it, redirect me to a new page with more info about this entry i clicked?
here is the code:
echo '<ol>';
while ($row = mysql_fetch_array($sql)){
echo '<li>';
echo '<img src="'.$row['Bio']. '" alt="" width="110" height="110">';
echo ' <dl>';
echo ' <dt>Name</dt>';
echo ' <dd>'.$row['Fname'].'</dd>';
echo ' <dt>Genre</dt>';
echo ' <dd>'.$row['Genre'].'</dd>';
echo ' <dt>Speciality</dt>';
echo ' <dd>'.$row['Specialty'].'</dd>';
echo ' </dl>';
echo '</li>';
}
echo '</ol>'; | 0 |
11,327,417 | 07/04/2012 10:39:09 | 185,824 | 10/07/2009 18:07:14 | 2,272 | 95 | User defined form creation | I have a requirement to create dynamic fields for form. Searched online and here and found [this design guideline][1] while it miss some of my requirements. I don't need exact code but general guideline.
**User** will have DropDownList with **Properties** he can add. Each **Property** divided into two parts. First part is for **User** to use for **SearchCombination** ( combination of **Properties**) and other part is for **Customer** to use.
ie. **User** chooses **Age** in DropDownList, this should produce **AgeFrom/AgeTo** DropdownLists on **SearchCombination** page and Day/Month/Year DropDownLists on **Customer** page.
How can i tackle this problem? Again i need only guideline and no real code unless you want to so please no suggestions "What have you tried", this is design question.
Thanks
[1]: http://stackoverflow.com/questions/792278/dynamic-form-generation-in-asp-net | c# | asp.net | null | null | null | null | open | User defined form creation
===
I have a requirement to create dynamic fields for form. Searched online and here and found [this design guideline][1] while it miss some of my requirements. I don't need exact code but general guideline.
**User** will have DropDownList with **Properties** he can add. Each **Property** divided into two parts. First part is for **User** to use for **SearchCombination** ( combination of **Properties**) and other part is for **Customer** to use.
ie. **User** chooses **Age** in DropDownList, this should produce **AgeFrom/AgeTo** DropdownLists on **SearchCombination** page and Day/Month/Year DropDownLists on **Customer** page.
How can i tackle this problem? Again i need only guideline and no real code unless you want to so please no suggestions "What have you tried", this is design question.
Thanks
[1]: http://stackoverflow.com/questions/792278/dynamic-form-generation-in-asp-net | 0 |
11,327,421 | 07/04/2012 09:32:14 | 1,490,501 | 06/29/2012 06:56:40 | 11 | 1 | SQL Server 2008 time zone conversion | In my web app, all date values are converted to UTC before being passed into the SQL database and then converted back to local time whenever they are displayed in the app. So the bottom line is that all dates are in UTC in the database.
That worked just fine until I started report development. Crystal Reports has no ability (that I can detect) to do a time zone conversion so I need to do the conversion within SQL before passing the value to the report.
SQL Server appears to have a much more limited ability to convert datetime values. The only function I see is SWITCHOFFSET. The problem with this function is that it is not daylight-savings aware which seems to be a major flaw. In asp.net, I can pass a datetime value with a time zone and it will automatically convert it to UTC time, taking account of any needed daylight savings time adjustments.
In SQL though, instead of saying something like
SWITCHOFFSET (SomeDate,"Eastern Time"),
I now have to say
SWITCHOFFSET(SomeDate, "-4:00").
But what happens if I'm pulling data from a table and I ask for all of the data for March, the month when daylight savings starts? No matter what, some of it will be incorrect. I can either say -4:00 or -5:00 but obviously, not both.
Is there some other function to adjust for this as, frankly, it seems SWITCHOFFSET is half baked if it doesn't know how to do a daylight savings conversion. | sql-server | timezone | null | null | null | null | open | SQL Server 2008 time zone conversion
===
In my web app, all date values are converted to UTC before being passed into the SQL database and then converted back to local time whenever they are displayed in the app. So the bottom line is that all dates are in UTC in the database.
That worked just fine until I started report development. Crystal Reports has no ability (that I can detect) to do a time zone conversion so I need to do the conversion within SQL before passing the value to the report.
SQL Server appears to have a much more limited ability to convert datetime values. The only function I see is SWITCHOFFSET. The problem with this function is that it is not daylight-savings aware which seems to be a major flaw. In asp.net, I can pass a datetime value with a time zone and it will automatically convert it to UTC time, taking account of any needed daylight savings time adjustments.
In SQL though, instead of saying something like
SWITCHOFFSET (SomeDate,"Eastern Time"),
I now have to say
SWITCHOFFSET(SomeDate, "-4:00").
But what happens if I'm pulling data from a table and I ask for all of the data for March, the month when daylight savings starts? No matter what, some of it will be incorrect. I can either say -4:00 or -5:00 but obviously, not both.
Is there some other function to adjust for this as, frankly, it seems SWITCHOFFSET is half baked if it doesn't know how to do a daylight savings conversion. | 0 |
11,327,426 | 07/04/2012 10:39:33 | 1,426,281 | 05/30/2012 14:32:33 | 13 | 0 | Boost threads unavailable on this platform compile error in eclipse | I am writing a program that have to use the library boost/thread. I install the library with macports on my os X lion. I include in my project under eclipse the library and then I compile my program. I have this error Boost threads unavailable on this platform.
In a post I have read that I have to use -pthread flag under GCC C++ -> Miscellaneous -> other flags, but I have the same error.
Any idea?
thanks | eclipse | boost | boost-thread | null | null | null | open | Boost threads unavailable on this platform compile error in eclipse
===
I am writing a program that have to use the library boost/thread. I install the library with macports on my os X lion. I include in my project under eclipse the library and then I compile my program. I have this error Boost threads unavailable on this platform.
In a post I have read that I have to use -pthread flag under GCC C++ -> Miscellaneous -> other flags, but I have the same error.
Any idea?
thanks | 0 |
11,327,427 | 07/04/2012 10:39:36 | 818,706 | 06/28/2011 07:24:48 | 137 | 12 | Pentaho Community Edition Directory Struture, Plugins Integration and MySQL Connection | I am working on Pentaho Community Edition in the Windows Environment and downloaded the latest Pentaho BI Server File from Sourceforge.net.(file name biserver-ce-4.5.0-stable.zip) and extacted it to C:\Program Files\Pentaho
so that my directory structure becomes
> C:\
> |
> -----Program Files
>
> |----------administration-console
>
> |----------biserver-ce
Now what i am doing for running the PUC and PAC is firt start the tomcat from the bat file located at
> C:\Program Files\Pentaho\biserver-ce\tomcat\bin\startup.bat
After tomcat has started i start the BI server from the file
> C:\Program Files\Pentaho\biserver-ce\start-pentaho.bat
and finally the Administrative Console from
> C:\Program Files\Pentaho\administration-console\start-pac.bat
The first Question is that What i am doing is correct or not.
Secondly i have seen in tutorials that the admin panel Left Menu contains options as Home, Administration, Status, Configuration, Utilities etc but on my side i have just two options in the Admin Console, Home and Administration. How can i add/include those other options.
Third Question is i have downloaded `Pentaho Data Integration-CE-4.3.0` and `Pentaho Report Design -CE-3.9.0-GA` file but how do i place them in the Current Pentaho Directory structure to access them.
Fourth Question is how can i connect the Pentaho BI server to databases that i have in my local system accessible through MySQL. | java | mysql | pentaho | null | null | null | open | Pentaho Community Edition Directory Struture, Plugins Integration and MySQL Connection
===
I am working on Pentaho Community Edition in the Windows Environment and downloaded the latest Pentaho BI Server File from Sourceforge.net.(file name biserver-ce-4.5.0-stable.zip) and extacted it to C:\Program Files\Pentaho
so that my directory structure becomes
> C:\
> |
> -----Program Files
>
> |----------administration-console
>
> |----------biserver-ce
Now what i am doing for running the PUC and PAC is firt start the tomcat from the bat file located at
> C:\Program Files\Pentaho\biserver-ce\tomcat\bin\startup.bat
After tomcat has started i start the BI server from the file
> C:\Program Files\Pentaho\biserver-ce\start-pentaho.bat
and finally the Administrative Console from
> C:\Program Files\Pentaho\administration-console\start-pac.bat
The first Question is that What i am doing is correct or not.
Secondly i have seen in tutorials that the admin panel Left Menu contains options as Home, Administration, Status, Configuration, Utilities etc but on my side i have just two options in the Admin Console, Home and Administration. How can i add/include those other options.
Third Question is i have downloaded `Pentaho Data Integration-CE-4.3.0` and `Pentaho Report Design -CE-3.9.0-GA` file but how do i place them in the Current Pentaho Directory structure to access them.
Fourth Question is how can i connect the Pentaho BI server to databases that i have in my local system accessible through MySQL. | 0 |
11,262,172 | 06/29/2012 12:54:17 | 580,010 | 01/18/2011 13:37:50 | 528 | 4 | PL/pgSQL: Return RECORD or TABLE | I am writing a PL/pgSQL function which accepts as an input parameter a key value, selects a number of rows from a table with that key, performs some calculations, and then returns 10 `SMALLINT` values. The function presently returns the 10 values as a `RECORD` type.
This solution makes downstream processing more difficult. I found an excellent [answer][1] which explains how to split the `RECORD` values into columns. This is further complicated though if I want to also include the key value in the `SELECT` results, as the key is not returned in the `RECORD`. I could include it of course, but what if I wanted another column or a column from another table?
**Question:** In this case, would it be better for the function to create and populate a table? Or to return a `TABLE`? I'm sure this is a common enough concept: store the results or calculate them on the fly every time they are needed? I'm starting to think that creating a table would be the best solution because all those data are there for easy querying and further analysis later.
[1]: http://stackoverflow.com/a/6085167/580010 | postgresql | postgresql-8.4 | null | null | null | 06/29/2012 20:39:22 | not a real question | PL/pgSQL: Return RECORD or TABLE
===
I am writing a PL/pgSQL function which accepts as an input parameter a key value, selects a number of rows from a table with that key, performs some calculations, and then returns 10 `SMALLINT` values. The function presently returns the 10 values as a `RECORD` type.
This solution makes downstream processing more difficult. I found an excellent [answer][1] which explains how to split the `RECORD` values into columns. This is further complicated though if I want to also include the key value in the `SELECT` results, as the key is not returned in the `RECORD`. I could include it of course, but what if I wanted another column or a column from another table?
**Question:** In this case, would it be better for the function to create and populate a table? Or to return a `TABLE`? I'm sure this is a common enough concept: store the results or calculate them on the fly every time they are needed? I'm starting to think that creating a table would be the best solution because all those data are there for easy querying and further analysis later.
[1]: http://stackoverflow.com/a/6085167/580010 | 1 |
11,262,173 | 06/29/2012 12:54:23 | 729,789 | 04/28/2011 17:13:24 | 379 | 3 | DOM manipulation in codeigniter before page loads | is there a way to modify the html of a view file before or as it is loaded, such that a containing div element can be wrapped around existing elements that have a particular class.
So as an example:
if i have the element
<div class="add-wrapper-to-this-elem">
</div>
somewhere within the view file test_view.php, when i load the view via `$this->load->view('test_view');` i would then like the view to load with an extra wrapper div around all elements with the class of add-wrapper-to-elem
is this possible and how would i go about it? | php | codeigniter | content-management-system | null | null | null | open | DOM manipulation in codeigniter before page loads
===
is there a way to modify the html of a view file before or as it is loaded, such that a containing div element can be wrapped around existing elements that have a particular class.
So as an example:
if i have the element
<div class="add-wrapper-to-this-elem">
</div>
somewhere within the view file test_view.php, when i load the view via `$this->load->view('test_view');` i would then like the view to load with an extra wrapper div around all elements with the class of add-wrapper-to-elem
is this possible and how would i go about it? | 0 |
11,251,614 | 06/28/2012 19:33:33 | 1,489,529 | 06/28/2012 18:55:00 | 1 | 0 | SCRIPT5009: 'slickcontactparse' is undefined | I am new to working with Javascript and I needed a contact form for an RSVP. The question I have is that the form works fine in Firefox, Chrome, and Safari. The problem lies in IE. I have had reports that the form breaks and they receive a Javascript error. I have not been able to recreate this error so I am at a loss. It all works fine on my end and a few other computers I have tried. The only thing I noticed is that if I submit the form with the IE Developer tools enabled, I see the error message in my Subject Title pop up.
The address for the live form is at: rss-rsvp.org
Any help would be greatly appreciated! | javascript | html | ajax | forms | contact | null | open | SCRIPT5009: 'slickcontactparse' is undefined
===
I am new to working with Javascript and I needed a contact form for an RSVP. The question I have is that the form works fine in Firefox, Chrome, and Safari. The problem lies in IE. I have had reports that the form breaks and they receive a Javascript error. I have not been able to recreate this error so I am at a loss. It all works fine on my end and a few other computers I have tried. The only thing I noticed is that if I submit the form with the IE Developer tools enabled, I see the error message in my Subject Title pop up.
The address for the live form is at: rss-rsvp.org
Any help would be greatly appreciated! | 0 |
11,260,737 | 06/29/2012 11:11:23 | 1,456,376 | 06/14/2012 13:44:02 | 369 | 24 | SEO - duplicate content with Javascript slide deck | I have a custom slide deck with this functionality:
- when sliding or selecting a preview the displayed content and the URL (HTML5 History) change
- with a clean-URL (e.g. "/slide-5") the user starts directly at the selected position
- all slide previews have the clean-URL in a href
This works fine, even without JavaScript the user can see every slide (without the animation and involving a page load of course).
The question is: A search engine sees all links. But basically all links have the same content. Can this cause the page rank to decrease? And if so, what would be the best solution to this problem? I only can image a solution like this:
- regarding the clean-URL only the content of the selected slide is on the page
- the rest of the content is displayed with javascript, when sliding
- this would also work with JavaScript disabled
Maybe you have some good thoughts. | javascript | html | seo | seo-friendly | null | null | open | SEO - duplicate content with Javascript slide deck
===
I have a custom slide deck with this functionality:
- when sliding or selecting a preview the displayed content and the URL (HTML5 History) change
- with a clean-URL (e.g. "/slide-5") the user starts directly at the selected position
- all slide previews have the clean-URL in a href
This works fine, even without JavaScript the user can see every slide (without the animation and involving a page load of course).
The question is: A search engine sees all links. But basically all links have the same content. Can this cause the page rank to decrease? And if so, what would be the best solution to this problem? I only can image a solution like this:
- regarding the clean-URL only the content of the selected slide is on the page
- the rest of the content is displayed with javascript, when sliding
- this would also work with JavaScript disabled
Maybe you have some good thoughts. | 0 |
11,260,738 | 06/29/2012 11:11:29 | 1,138,620 | 01/09/2012 12:08:57 | 156 | 5 | How would I be able to achieve this expandable layout in Java? Flexible BoxLayout etc | I would like to be able to have three JPanels p1 p2 and p3, and have them lay out like so:
![Layout][1]
[1]: http://i.stack.imgur.com/vSlCa.png
I have been playing around with FlowLayout, BoxLayout etc but I'm not really sure if I am heading in the right direction. I am quite new with Java so I don't know what does what if I'm quite honest.
I like how BoxLayout works, resizing the panels, but I would like to be able to give it some sort of width attribute.
I am not using a visual designer for this, this is my window code at the moment:
private void initialize() {
Dimension dimensions = Toolkit.getDefaultToolkit().getScreenSize();
frame = new JFrame();
frame.setLayout(new GridLayout(1, 3));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setBounds(dimensions.width / 2 - WINDOW_WIDTH / 2,
dimensions.height / 2 - WINDOW_HEIGHT / 2,
WINDOW_WIDTH, WINDOW_HEIGHT);
JPanel p1 = new JPanel(new BorderLayout());
p1.setBackground(Color.red);
JPanel p2 = new JPanel(new BorderLayout());
p2.setBackground(Color.black);
JPanel p3 = new JPanel(new BorderLayout());
p3.setBackground(Color.blue);
frame.add(p2);
frame.add(p1);
frame.add(p3);
}
Any pointers appreciated! | java | swing | null | null | null | null | open | How would I be able to achieve this expandable layout in Java? Flexible BoxLayout etc
===
I would like to be able to have three JPanels p1 p2 and p3, and have them lay out like so:
![Layout][1]
[1]: http://i.stack.imgur.com/vSlCa.png
I have been playing around with FlowLayout, BoxLayout etc but I'm not really sure if I am heading in the right direction. I am quite new with Java so I don't know what does what if I'm quite honest.
I like how BoxLayout works, resizing the panels, but I would like to be able to give it some sort of width attribute.
I am not using a visual designer for this, this is my window code at the moment:
private void initialize() {
Dimension dimensions = Toolkit.getDefaultToolkit().getScreenSize();
frame = new JFrame();
frame.setLayout(new GridLayout(1, 3));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setBounds(dimensions.width / 2 - WINDOW_WIDTH / 2,
dimensions.height / 2 - WINDOW_HEIGHT / 2,
WINDOW_WIDTH, WINDOW_HEIGHT);
JPanel p1 = new JPanel(new BorderLayout());
p1.setBackground(Color.red);
JPanel p2 = new JPanel(new BorderLayout());
p2.setBackground(Color.black);
JPanel p3 = new JPanel(new BorderLayout());
p3.setBackground(Color.blue);
frame.add(p2);
frame.add(p1);
frame.add(p3);
}
Any pointers appreciated! | 0 |
11,262,177 | 06/29/2012 12:54:35 | 1,479,485 | 06/25/2012 09:09:05 | 26 | 0 | sending email in c# using port no | I want to send email from yahoo to yahoo bt failed to send it.I use network
received.pease review my code credential There is no exception or error
but when mail box is opned no email .I used label which show suuccesfull text ,but
at that time, it is not showing successfull.
**.aspx code:**
<form id="form1" runat="server">
Message from: <asp:TextBox ID="text1" runat="server"></asp:TextBox>
Message To: <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
Message subject: <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:Button ID="b1" runat="server" OnClick="click" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</form>
.aspx.cs
public void click(object sender, EventArgs e)
{
try
{
//mail message
MailMessage mM = new MailMessage();
//Mail Address
mM.From = new MailAddress(text1.Text);
//emailid to send
mM.To.Add(TextBox1.Text);
//your subject line of the message
mM.Subject = "your subject line will go here.";
//now attached the file
// mM.Attachments.Add(new Attachment(@"C:\\attachedfile.jpg"));
//add the body of the email
mM.Body = "Your Body of the email.";
mM.IsBodyHtml = false;
//SMTP
SmtpClient SmtpServer = new SmtpClient();
//your credential will go here
SmtpServer.Credentials = new
System.Net.NetworkCredential("username", "password");a``
//port number to login yahoo server
SmtpServer.Port = 587;
//yahoo host name
SmtpServer.Host = "smtp.mail.yahoo.com";
SmtpServer.EnableSsl = true;
SmtpServer.Send(mM);
Label1.Text = "successfull";
//Send the email
//end of try block
//end of catch
}
catch(Exception ee){
Console.Write(ee);
}``
| .net | email | null | null | null | null | open | sending email in c# using port no
===
I want to send email from yahoo to yahoo bt failed to send it.I use network
received.pease review my code credential There is no exception or error
but when mail box is opned no email .I used label which show suuccesfull text ,but
at that time, it is not showing successfull.
**.aspx code:**
<form id="form1" runat="server">
Message from: <asp:TextBox ID="text1" runat="server"></asp:TextBox>
Message To: <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
Message subject: <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:Button ID="b1" runat="server" OnClick="click" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</form>
.aspx.cs
public void click(object sender, EventArgs e)
{
try
{
//mail message
MailMessage mM = new MailMessage();
//Mail Address
mM.From = new MailAddress(text1.Text);
//emailid to send
mM.To.Add(TextBox1.Text);
//your subject line of the message
mM.Subject = "your subject line will go here.";
//now attached the file
// mM.Attachments.Add(new Attachment(@"C:\\attachedfile.jpg"));
//add the body of the email
mM.Body = "Your Body of the email.";
mM.IsBodyHtml = false;
//SMTP
SmtpClient SmtpServer = new SmtpClient();
//your credential will go here
SmtpServer.Credentials = new
System.Net.NetworkCredential("username", "password");a``
//port number to login yahoo server
SmtpServer.Port = 587;
//yahoo host name
SmtpServer.Host = "smtp.mail.yahoo.com";
SmtpServer.EnableSsl = true;
SmtpServer.Send(mM);
Label1.Text = "successfull";
//Send the email
//end of try block
//end of catch
}
catch(Exception ee){
Console.Write(ee);
}``
| 0 |
11,262,178 | 06/29/2012 12:54:36 | 1,202,276 | 02/10/2012 14:56:23 | 11 | 0 | Tabletool Icon Removes Select entries from toolbar | Hi I am using below code to display tabletool in datatable, everythings work perfectly but tabletool icons remove Select entry icon, any idea how can i display both in same div.
$(document).ready(function () {
$('#tblOscarNominees').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"sDom": '<"H"Tfr>t<"F"ip>',
"oTableTools": {
"sSwfPath": "../DataTables/media/swf/copy_csv_xls_pdf.swf"
}
});
Thanks in advance | asp.net | null | null | null | null | null | open | Tabletool Icon Removes Select entries from toolbar
===
Hi I am using below code to display tabletool in datatable, everythings work perfectly but tabletool icons remove Select entry icon, any idea how can i display both in same div.
$(document).ready(function () {
$('#tblOscarNominees').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"sDom": '<"H"Tfr>t<"F"ip>',
"oTableTools": {
"sSwfPath": "../DataTables/media/swf/copy_csv_xls_pdf.swf"
}
});
Thanks in advance | 0 |
11,262,182 | 06/29/2012 12:54:50 | 1,445,985 | 06/09/2012 09:08:20 | 17 | 1 | PHP include without output? | Alright,
Heres the thing. I have a (paid for) shopping cart, which I am currently in the process of jazzing up with jquery and css and whatever else to make it look and work much nicer than it currently is.
Anyway. In order to use their database and their functions etc, I need to include their file at the beginning of the webpage. I have put it in a
<div style="display:none;">
But of course any output is still written to the browser. its not alot, but I would prefere to have NO div and NO output, but i still want it to perform it's calculations. Its 5000 line PHP file and Its too complicated to go through and edit out the bits I dont want.
is there a clever way, that I can include the file but specify if I want anything written to page when including it?
I knows it's a bit of a bodge, I hope i've explained myself, if anyone can help please let me know.
Thanks. | php | html | include | output | null | null | open | PHP include without output?
===
Alright,
Heres the thing. I have a (paid for) shopping cart, which I am currently in the process of jazzing up with jquery and css and whatever else to make it look and work much nicer than it currently is.
Anyway. In order to use their database and their functions etc, I need to include their file at the beginning of the webpage. I have put it in a
<div style="display:none;">
But of course any output is still written to the browser. its not alot, but I would prefere to have NO div and NO output, but i still want it to perform it's calculations. Its 5000 line PHP file and Its too complicated to go through and edit out the bits I dont want.
is there a clever way, that I can include the file but specify if I want anything written to page when including it?
I knows it's a bit of a bodge, I hope i've explained myself, if anyone can help please let me know.
Thanks. | 0 |
11,280,326 | 07/01/2012 07:39:08 | 514,054 | 11/19/2010 22:40:09 | 129 | 6 | django.contrib.comments and multiple comment forms | I followed the guide at https://docs.djangoproject.com/en/dev/ref/contrib/comments/custom/ to set up a comment form on News entries for my current django app. Now, I need to have a comment form with different fields for another type of Object in another part of the site.
How should this be accomplised considering I've overridden the contact form already? | django | null | null | null | null | null | open | django.contrib.comments and multiple comment forms
===
I followed the guide at https://docs.djangoproject.com/en/dev/ref/contrib/comments/custom/ to set up a comment form on News entries for my current django app. Now, I need to have a comment form with different fields for another type of Object in another part of the site.
How should this be accomplised considering I've overridden the contact form already? | 0 |
11,280,336 | 07/01/2012 07:40:56 | 1,493,285 | 06/30/2012 16:55:25 | 20 | 0 | In a Spring MVC Hibernate Application , image page is getting changed from jsp to controller class? | In a Spring MVC hibernate app , I am selecting image from JSP and sending it to controller , but image path is getting changed because of this I am getting file not found error...
**This is my jsp code :**
> <form name="reguserform">
> <input type="file" name="userImage" id="userImage"/>
> </form>
here I am selecting image from D: drive **D:\25986.jpeg**
**and below is my controller class code :**
public String regUser(@RequestParam("userImage") File userImage) {
System.out.println("Image = "+ userImage);
}
// here i am getting : **Image = C:\fakepath\25986.jpeg**
because of this I cannot procced.
I dont know why image path is getting changed automatically. could somebody help me ? | java | hibernate | spring-mvc | null | null | null | open | In a Spring MVC Hibernate Application , image page is getting changed from jsp to controller class?
===
In a Spring MVC hibernate app , I am selecting image from JSP and sending it to controller , but image path is getting changed because of this I am getting file not found error...
**This is my jsp code :**
> <form name="reguserform">
> <input type="file" name="userImage" id="userImage"/>
> </form>
here I am selecting image from D: drive **D:\25986.jpeg**
**and below is my controller class code :**
public String regUser(@RequestParam("userImage") File userImage) {
System.out.println("Image = "+ userImage);
}
// here i am getting : **Image = C:\fakepath\25986.jpeg**
because of this I cannot procced.
I dont know why image path is getting changed automatically. could somebody help me ? | 0 |
11,280,337 | 07/01/2012 07:41:13 | 976,050 | 10/03/2011 04:13:20 | 84 | 0 | Download document from sqlite through website | I have store a sample document inside my local server named template.doc. Then I store the file directory inside my sqlite table. I manage to call out the path of the file directory but how can I allow the user to download it?
Kindly advise if it's possible to do it. Just for local testing. Thanks alot! | php | sqlite3 | null | null | null | null | open | Download document from sqlite through website
===
I have store a sample document inside my local server named template.doc. Then I store the file directory inside my sqlite table. I manage to call out the path of the file directory but how can I allow the user to download it?
Kindly advise if it's possible to do it. Just for local testing. Thanks alot! | 0 |
11,280,331 | 07/01/2012 07:39:53 | 712,104 | 04/17/2011 12:31:54 | 745 | 22 | change the return key | I want to change the name of enter button (the button circled in the image ) to search
![enter image description here][1]
so I used
<EditText
android:imeOptions="actionUnspecified"
android:imeActionLabel="Search"
but it didn't work
[1]: http://i.stack.imgur.com/OQuUY.jpg | android | android-keypad | null | null | null | null | open | change the return key
===
I want to change the name of enter button (the button circled in the image ) to search
![enter image description here][1]
so I used
<EditText
android:imeOptions="actionUnspecified"
android:imeActionLabel="Search"
but it didn't work
[1]: http://i.stack.imgur.com/OQuUY.jpg | 0 |
11,280,342 | 07/01/2012 07:42:42 | 634,877 | 02/25/2011 21:08:24 | 595 | 7 | Nesting inner array as value in pre-existing multi-dimensional array | I have an array called:
`$fragment = array($fragment);`
Which has the following (3) values:
`["<div class=\"alert alert_error mt20\"><a class=\"js-alert-close close\"><\/a>Please enter a title <\/div>"]
`
`["<div class=\"alert alert_error mt20\"><a class=\"js-alert-close close\"><\/a>Enter a valid source URL (e.g. http:\/\/en.wikipedia.org\/wiki\/Penguins) <\/div>"]`
`["<div class=\"alert alert_error mt20\"><a class=\"js-alert-close close\"><\/a>Please choose a category <\/div>"]`
I want to merge that array into another array (into the `'fragment'` key) which looks like:
$toReturn = array(
'status' => $status,
'formData' => $formData,
'inputs' => $inputs,
'fragment' => $fragment
);
But every time I do so, it just adds the first value of `$fragment` which is:
`"<div class=\"alert alert_error mt20\"><a class=\"js-alert-close close\"><\/a>Please enter a title <\/div>"`
How can I add all 3 values from `$fragment` into my `$toReturn` array instead? | php | json | php5 | json-encode | null | null | open | Nesting inner array as value in pre-existing multi-dimensional array
===
I have an array called:
`$fragment = array($fragment);`
Which has the following (3) values:
`["<div class=\"alert alert_error mt20\"><a class=\"js-alert-close close\"><\/a>Please enter a title <\/div>"]
`
`["<div class=\"alert alert_error mt20\"><a class=\"js-alert-close close\"><\/a>Enter a valid source URL (e.g. http:\/\/en.wikipedia.org\/wiki\/Penguins) <\/div>"]`
`["<div class=\"alert alert_error mt20\"><a class=\"js-alert-close close\"><\/a>Please choose a category <\/div>"]`
I want to merge that array into another array (into the `'fragment'` key) which looks like:
$toReturn = array(
'status' => $status,
'formData' => $formData,
'inputs' => $inputs,
'fragment' => $fragment
);
But every time I do so, it just adds the first value of `$fragment` which is:
`"<div class=\"alert alert_error mt20\"><a class=\"js-alert-close close\"><\/a>Please enter a title <\/div>"`
How can I add all 3 values from `$fragment` into my `$toReturn` array instead? | 0 |
11,280,343 | 07/01/2012 07:42:51 | 1,233,661 | 02/26/2012 10:21:55 | 3 | 0 | How to plot family tree in R | I've been searching around how to plot a family tree but couldn't find something i could reproduce. I've been looking in Hadley's book about ggplot but the same think.
I want to plot a family tree having using as a source a dataframe similar to this:
dput(head(familyTree))
structure(list(id = 1:6, cnp = c("11", NA, "22",
NA, NA, "33"), last_name = c("B", "B",
"B", NA, NA, "M"), last_name_alyas = c(NA, NA, NA,
NA, NA, "M"), middle_name = c("C", NA, NA, NA,
NA, NA), first_name = c("Me", "P", "A", NA,
NA, "S"), first_name_alyas = c(NA, NA, NA, NA, NA, "F"
), maiden_name = c(NA, NA, "M", NA, NA, NA), id_father = c(2L,
4L, 6L, NA, NA, 8L), id_mother = c(3L, 5L, 7L, NA, NA, 9L), birth_date = c("1986-01-01",
"1963-01-01", "1964-01-01", NA, NA, "1936-01-01"), birth_place = c("City",
"Village", "Village",
NA, NA, "Village"), death_date = c("0000-00-00",
NA, NA, NA, NA, "2007-12-23"), death_reason = c(NA, NA, NA, NA,
NA, "stroke"), nr_brothers = c(NA, 1L, NA, NA, NA, NA),
brothers_names = c(NA, "M", NA, NA, NA, NA), nr_sisters = c(1L,
NA, 1L, NA, NA, 2L), sisters_names = c("A", NA, "E",
NA, NA, NA), school = c(NA, "",
"", NA, NA, ""
), occupation = c(NA, "", "",
NA, NA, ""), diseases = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_), comments = c(NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_
)), .Names = c("id", "cnp", "last_name", "last_name_alyas",
"middle_name", "first_name", "first_name_alyas", "maiden_name",
"id_father", "id_mother", "birth_date", "birth_place", "death_date",
"death_reason", "nr_brothers", "brothers_names", "nr_sisters",
"sisters_names", "school", "occupation", "diseases", "comments"
), row.names = c(NA, 6L), class = "data.frame")
Is there any way I can plot a family tree with ggplot? If not, how can i plot it using another package.
The primary key is 'id' and you connect to other members of the family using "id_father" and "id_mother" | r | null | null | null | null | null | open | How to plot family tree in R
===
I've been searching around how to plot a family tree but couldn't find something i could reproduce. I've been looking in Hadley's book about ggplot but the same think.
I want to plot a family tree having using as a source a dataframe similar to this:
dput(head(familyTree))
structure(list(id = 1:6, cnp = c("11", NA, "22",
NA, NA, "33"), last_name = c("B", "B",
"B", NA, NA, "M"), last_name_alyas = c(NA, NA, NA,
NA, NA, "M"), middle_name = c("C", NA, NA, NA,
NA, NA), first_name = c("Me", "P", "A", NA,
NA, "S"), first_name_alyas = c(NA, NA, NA, NA, NA, "F"
), maiden_name = c(NA, NA, "M", NA, NA, NA), id_father = c(2L,
4L, 6L, NA, NA, 8L), id_mother = c(3L, 5L, 7L, NA, NA, 9L), birth_date = c("1986-01-01",
"1963-01-01", "1964-01-01", NA, NA, "1936-01-01"), birth_place = c("City",
"Village", "Village",
NA, NA, "Village"), death_date = c("0000-00-00",
NA, NA, NA, NA, "2007-12-23"), death_reason = c(NA, NA, NA, NA,
NA, "stroke"), nr_brothers = c(NA, 1L, NA, NA, NA, NA),
brothers_names = c(NA, "M", NA, NA, NA, NA), nr_sisters = c(1L,
NA, 1L, NA, NA, 2L), sisters_names = c("A", NA, "E",
NA, NA, NA), school = c(NA, "",
"", NA, NA, ""
), occupation = c(NA, "", "",
NA, NA, ""), diseases = c(NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_,
NA_character_), comments = c(NA_character_, NA_character_,
NA_character_, NA_character_, NA_character_, NA_character_
)), .Names = c("id", "cnp", "last_name", "last_name_alyas",
"middle_name", "first_name", "first_name_alyas", "maiden_name",
"id_father", "id_mother", "birth_date", "birth_place", "death_date",
"death_reason", "nr_brothers", "brothers_names", "nr_sisters",
"sisters_names", "school", "occupation", "diseases", "comments"
), row.names = c(NA, 6L), class = "data.frame")
Is there any way I can plot a family tree with ggplot? If not, how can i plot it using another package.
The primary key is 'id' and you connect to other members of the family using "id_father" and "id_mother" | 0 |
11,567,590 | 07/19/2012 19:03:30 | 843,580 | 07/13/2011 21:47:57 | 116 | 4 | What is BigData and NoSQL, any good books on both? | I know I am asking two questions in one. But can someone please tell me what is meant by bigdata. Also how does NoSQL different from conventional SQL.
Lastly can you please recommend good/best books or tutorials/website on topic which can take a newbie to advance level.
Please reply. | nosql | bigdata | null | null | null | null | open | What is BigData and NoSQL, any good books on both?
===
I know I am asking two questions in one. But can someone please tell me what is meant by bigdata. Also how does NoSQL different from conventional SQL.
Lastly can you please recommend good/best books or tutorials/website on topic which can take a newbie to advance level.
Please reply. | 0 |
11,567,591 | 07/19/2012 19:03:32 | 1,034,739 | 11/08/2011 00:38:23 | 3 | 2 | Using version control (SVN) for images | We have images stored in a file system in the following format. So that web applications can have access to those images with url (http://imageserver.domain.com/items/it1/small.jpg) through an http server.
> Now, to allow graphics team to have access to those images for
> adding/updating, I was thinking to setup an SVN rep for the folder
> “items”. Is this considered a best practice? Any suggestions? | image | svn | filesystems | storage | null | null | open | Using version control (SVN) for images
===
We have images stored in a file system in the following format. So that web applications can have access to those images with url (http://imageserver.domain.com/items/it1/small.jpg) through an http server.
> Now, to allow graphics team to have access to those images for
> adding/updating, I was thinking to setup an SVN rep for the folder
> “items”. Is this considered a best practice? Any suggestions? | 0 |
11,567,456 | 07/19/2012 18:54:36 | 1,538,836 | 07/19/2012 18:46:37 | 1 | 0 | Access Headless VM Over Multiple SSH Hops | I am attempting to access a headless VM running on an Ubuntu server over SSH. I need to make an SSH connection to my router and then to the Ubuntu Server or the VM. The machine is running, but I can't seem to figure out its IP address or how to initiate the connection. I have tried "VBoxManage guestproperty enumerate testvm1", but no IP information is returned. I have tried switching the VM settings from "bridged" to "NAT" with no success.
I have started the VM and am stuck here:
# vboxheadless --startvm "testvm1"
Oracle VM VirtualBox Headless Interface 4.1.12_Ubuntu
(C) 2008-2012 Oracle Corporation
All rights reserved.
VRDE server is listening on port 3389.
Any advice would be appreciated. | networking | ubuntu | ssh | vm | null | 07/21/2012 03:15:37 | off topic | Access Headless VM Over Multiple SSH Hops
===
I am attempting to access a headless VM running on an Ubuntu server over SSH. I need to make an SSH connection to my router and then to the Ubuntu Server or the VM. The machine is running, but I can't seem to figure out its IP address or how to initiate the connection. I have tried "VBoxManage guestproperty enumerate testvm1", but no IP information is returned. I have tried switching the VM settings from "bridged" to "NAT" with no success.
I have started the VM and am stuck here:
# vboxheadless --startvm "testvm1"
Oracle VM VirtualBox Headless Interface 4.1.12_Ubuntu
(C) 2008-2012 Oracle Corporation
All rights reserved.
VRDE server is listening on port 3389.
Any advice would be appreciated. | 2 |
11,567,458 | 07/19/2012 18:54:42 | 228,861 | 12/10/2009 14:27:45 | 748 | 38 | WinJS Share Target Redirect | In WinJS is it possible to redirect a page once it has been activated by using the share charm?
So my target page is /pages/target/target.html. In the .js I want to do something like;
`WinJS.Navigation.navigate("/pages/anotherpage/anotherpage.html");`
It doesn't seem to raise an error but it's not navigating away from the target page.
I want to redirect pages based on user input. | windows-8 | winjs | null | null | null | null | open | WinJS Share Target Redirect
===
In WinJS is it possible to redirect a page once it has been activated by using the share charm?
So my target page is /pages/target/target.html. In the .js I want to do something like;
`WinJS.Navigation.navigate("/pages/anotherpage/anotherpage.html");`
It doesn't seem to raise an error but it's not navigating away from the target page.
I want to redirect pages based on user input. | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.