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,627,872 | 07/24/2012 09:25:12 | 1,287,496 | 03/23/2012 04:30:19 | 28 | 0 | Potential leak of an object allocated | after **Analyze** my cocos2d game I've got an warning "Potential leak of an object allocated on line 525 and stored into 'valueString'" in this code
525 NSString * valueString=[[[NSString alloc] initWithString:[NSString stringWithFormat:@"%@: %@",kGameTimeeng,[allFunctions getTimeFormat:(int) _timeLimit]]] retain];
if([_language isEqualToString:@"rus"]){
[valueString release];
valueString=[[[NSString alloc] initWithString:[NSString stringWithFormat:@"%@: %@",kGameTimerus,[allFunctions getTimeFormat:(int) _timeLimit]]] retain];
}
id sequence=[CCSequence actions:
[CCCallFuncND actionWithTarget: allFunctions selector: @selector(setLabelColor:withIndex:) data:(void*)color],
[CCCallFuncND actionWithTarget: allFunctions selector: @selector(setLabelValue:withValue:) data:(NSString*)valueString],
// [CCCallFuncND actionWithTarget: self selector: @selector(setLabelStroke:withTag:) data:(void*)TagCurentPointsLabelStroke],
[CCBlink actionWithDuration:0.5f blinks:2],
[CCShow action],
[CCCallFuncND actionWithTarget: allFunctions selector: @selector(setLabelColor:withIndex:) data:(void*)colorAfter],
nil];
[_timeLimitLabel runAction:sequence];
[valueString release];
allFunctions.m
-(void) setLabelValue:(id) sender withValue:(NSString*) value
{
CCLabelTTF *label=(CCLabelTTF *)sender;
NSString * valueString=[[[NSString alloc] initWithString:[NSString stringWithFormat:@"%@",value]] autorelease];
[label setString:[NSString stringWithFormat:@"%@",valueString]];
//[valueString release];
}
can you explain me why? | ios | memory-leaks | cocos2d-iphone | null | null | null | open | Potential leak of an object allocated
===
after **Analyze** my cocos2d game I've got an warning "Potential leak of an object allocated on line 525 and stored into 'valueString'" in this code
525 NSString * valueString=[[[NSString alloc] initWithString:[NSString stringWithFormat:@"%@: %@",kGameTimeeng,[allFunctions getTimeFormat:(int) _timeLimit]]] retain];
if([_language isEqualToString:@"rus"]){
[valueString release];
valueString=[[[NSString alloc] initWithString:[NSString stringWithFormat:@"%@: %@",kGameTimerus,[allFunctions getTimeFormat:(int) _timeLimit]]] retain];
}
id sequence=[CCSequence actions:
[CCCallFuncND actionWithTarget: allFunctions selector: @selector(setLabelColor:withIndex:) data:(void*)color],
[CCCallFuncND actionWithTarget: allFunctions selector: @selector(setLabelValue:withValue:) data:(NSString*)valueString],
// [CCCallFuncND actionWithTarget: self selector: @selector(setLabelStroke:withTag:) data:(void*)TagCurentPointsLabelStroke],
[CCBlink actionWithDuration:0.5f blinks:2],
[CCShow action],
[CCCallFuncND actionWithTarget: allFunctions selector: @selector(setLabelColor:withIndex:) data:(void*)colorAfter],
nil];
[_timeLimitLabel runAction:sequence];
[valueString release];
allFunctions.m
-(void) setLabelValue:(id) sender withValue:(NSString*) value
{
CCLabelTTF *label=(CCLabelTTF *)sender;
NSString * valueString=[[[NSString alloc] initWithString:[NSString stringWithFormat:@"%@",value]] autorelease];
[label setString:[NSString stringWithFormat:@"%@",valueString]];
//[valueString release];
}
can you explain me why? | 0 |
11,214,032 | 06/26/2012 18:47:32 | 1,370,818 | 05/02/2012 18:47:49 | 16 | 3 | django-social-auth error 500: Premature end of script headers: django.wsgi | I am trying to use django-social-auth in my project.
It's working good on my local computer (using manage.py runserver), but fails on my hoster's (locum.ru) server(using mod_wsgi).
I see this in my django logs on the server:
[2012-06-26 22:19:24,796] DEBUG [django.db.backends:44] (0.000) SET FOREIGN_KEY_CHECKS=0;; args=()
[2012-06-26 22:19:24,817] DEBUG [django.db.backends:44] (0.000) SELECT `django_session`.`session_key`, `django_session`.`session_dat
a`, `django_session`.`expire_date` FROM `django_session` WHERE (`django_session`.`session_key` = 392a94a6d2a667ff755a9d45a79582d0 AN
D `django_session`.`expire_date` > 2012-06-26 22:19:24 ); args=('392a94a6d2a667ff755a9d45a79582d0', u'2012-06-26 22:19:24')
[2012-06-26 22:19:24,857] DEBUG [myapp.context_processors:11] Adding something to context.
(myapp.context_processors is just a simple context processor that does nothing except notifying me that it's called)
and this in error.log:
[Tue Jun 26 22:19:24 2012] [error] [client 34.34.34.34] Premature end of script headers: django.wsgi
When I turn django-social-auth off in my settings.py everything works good. When I turn it on - it fails!
I have python 2.7.3 locally and python 2.6.6 on server (but it works without social-auth, so that it not the issue, I think...) and Django 1.3.1.
Can anyone give me a hint where to dig?
| django | hosting | mod-wsgi | internal-server-error | django-socialauth | null | open | django-social-auth error 500: Premature end of script headers: django.wsgi
===
I am trying to use django-social-auth in my project.
It's working good on my local computer (using manage.py runserver), but fails on my hoster's (locum.ru) server(using mod_wsgi).
I see this in my django logs on the server:
[2012-06-26 22:19:24,796] DEBUG [django.db.backends:44] (0.000) SET FOREIGN_KEY_CHECKS=0;; args=()
[2012-06-26 22:19:24,817] DEBUG [django.db.backends:44] (0.000) SELECT `django_session`.`session_key`, `django_session`.`session_dat
a`, `django_session`.`expire_date` FROM `django_session` WHERE (`django_session`.`session_key` = 392a94a6d2a667ff755a9d45a79582d0 AN
D `django_session`.`expire_date` > 2012-06-26 22:19:24 ); args=('392a94a6d2a667ff755a9d45a79582d0', u'2012-06-26 22:19:24')
[2012-06-26 22:19:24,857] DEBUG [myapp.context_processors:11] Adding something to context.
(myapp.context_processors is just a simple context processor that does nothing except notifying me that it's called)
and this in error.log:
[Tue Jun 26 22:19:24 2012] [error] [client 34.34.34.34] Premature end of script headers: django.wsgi
When I turn django-social-auth off in my settings.py everything works good. When I turn it on - it fails!
I have python 2.7.3 locally and python 2.6.6 on server (but it works without social-auth, so that it not the issue, I think...) and Django 1.3.1.
Can anyone give me a hint where to dig?
| 0 |
11,298,203 | 07/02/2012 17:16:30 | 959,552 | 09/22/2011 16:17:04 | 42 | 3 | What parameter of function | class Scroll {
static boolean up;
static boolean down;
public static void scroll(boolean direction) {
if (/* ... */) {
System.out.println("UP");
}
else {
System.out.println("DOWN);
}
}
public class Test2 {
public static void main(String[] args) {
Scroll.scroll(Scroll.up);
}
}
**How can I check which field has function been called with - with `Scroll.up` or `Scroll.down`?** I know that in above code I could get same effect in other way, but it's simplified code with essence of my problem. | java | null | null | null | null | null | open | What parameter of function
===
class Scroll {
static boolean up;
static boolean down;
public static void scroll(boolean direction) {
if (/* ... */) {
System.out.println("UP");
}
else {
System.out.println("DOWN);
}
}
public class Test2 {
public static void main(String[] args) {
Scroll.scroll(Scroll.up);
}
}
**How can I check which field has function been called with - with `Scroll.up` or `Scroll.down`?** I know that in above code I could get same effect in other way, but it's simplified code with essence of my problem. | 0 |
11,298,205 | 07/02/2012 17:16:36 | 672,958 | 03/23/2011 12:00:15 | 160 | 10 | How can I open app url with fallback from Chrome for iOS | My website can open my app if it is installed using a URL and then fallback to an appstore link if not.
Unfortunately in Chrome for iOS this does not work as I get taken to a page that says 'Chrome cannot open this URL' (error -1002 (): Unsupported URL.)
Does anyone know how to get around this, I have tried ajax load request and timers to no avail. | ios | url | google-chrome | application | null | null | open | How can I open app url with fallback from Chrome for iOS
===
My website can open my app if it is installed using a URL and then fallback to an appstore link if not.
Unfortunately in Chrome for iOS this does not work as I get taken to a page that says 'Chrome cannot open this URL' (error -1002 (): Unsupported URL.)
Does anyone know how to get around this, I have tried ajax load request and timers to no avail. | 0 |
11,298,213 | 07/02/2012 17:17:41 | 1,190,806 | 02/05/2012 15:53:07 | 107 | 6 | Android: Accessing activity intents parent functions | Android: Accessing intents parent functions.
I have an activity that opens another activity though the intent class. I have to access the parent class functions (In order to change images from the child class). So far I have:
(In parent)
public static Activity _activity;
public void onCreate(Bundle savedInstanceState)
{
_activity = this;
}
Then in the child activity I've got:
private Activity _getImageActivity;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
_getImageActivity = GetImageActivity._activity;
}
This seems to work but _getImageActivity doesn't access any of the parents public functions.
Any ideas?
| android | android-intent | android-activity | null | null | null | open | Android: Accessing activity intents parent functions
===
Android: Accessing intents parent functions.
I have an activity that opens another activity though the intent class. I have to access the parent class functions (In order to change images from the child class). So far I have:
(In parent)
public static Activity _activity;
public void onCreate(Bundle savedInstanceState)
{
_activity = this;
}
Then in the child activity I've got:
private Activity _getImageActivity;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
_getImageActivity = GetImageActivity._activity;
}
This seems to work but _getImageActivity doesn't access any of the parents public functions.
Any ideas?
| 0 |
11,541,454 | 07/18/2012 12:33:09 | 1,123,105 | 12/30/2011 15:07:59 | 1 | 0 | please help me..about python thread pool | I recent used python writing a website spider,have a problem.Ideas are as follow:
Have a queue,thread get url from queue and call a function to get all links,pseudo code as follow:
class Spider(Threading.Thread):
def __init__(self):
self.queue = Queue.Queue
def run(self):
while True:
url = self.queue.get()
getAllLinks(url)
time.sleep(0.1) #note here,i take the initiative a I/O block
But the problem is:each after call getAllLinks is finished of switch thread,but not as single-threaded fast.There are better ways? | python | multithreading | null | null | null | null | open | please help me..about python thread pool
===
I recent used python writing a website spider,have a problem.Ideas are as follow:
Have a queue,thread get url from queue and call a function to get all links,pseudo code as follow:
class Spider(Threading.Thread):
def __init__(self):
self.queue = Queue.Queue
def run(self):
while True:
url = self.queue.get()
getAllLinks(url)
time.sleep(0.1) #note here,i take the initiative a I/O block
But the problem is:each after call getAllLinks is finished of switch thread,but not as single-threaded fast.There are better ways? | 0 |
11,541,338 | 07/18/2012 12:27:09 | 567,390 | 01/07/2011 19:37:53 | 494 | 47 | Should I use ArrayList<?> or List<?> | I'm developing for Android and wondered, what are the main differences between an ArrayList and a List? | android | optimization | null | null | null | null | open | Should I use ArrayList<?> or List<?>
===
I'm developing for Android and wondered, what are the main differences between an ArrayList and a List? | 0 |
11,541,339 | 07/18/2012 12:27:12 | 1,534,764 | 07/18/2012 12:22:36 | 1 | 0 | Vibrate Mode for ios in flash as3 | Is it possible to find if an iOS device is on "Vibrate Mode" while creating an app via Flash CS6 AIR for iOS 3.2 in as3? | ios | actionscript-3 | flash | air | null | null | open | Vibrate Mode for ios in flash as3
===
Is it possible to find if an iOS device is on "Vibrate Mode" while creating an app via Flash CS6 AIR for iOS 3.2 in as3? | 0 |
11,541,402 | 07/18/2012 12:30:44 | 330,867 | 05/02/2010 15:24:00 | 2,251 | 113 | Store enum name, not value in database using EBean | I have this enum :
public enum DocumentTypes {
PDF("PDF Document"), JPG("Image files (JPG)"), DOC("Microsoft Word documents");
private final String displayName;
DocumentTypes(final String display) {
this.displayName = display;
}
@Override
public String toString() {
return this.displayName;
}
}
And a model like this :
@Entity
@Table(name = "documents")
public class Document extends Model {
@Id
public Long id;
@Constraints.Required
@Formats.NonEmpty
@Enumerated(EnumType.STRING)
@Column(length=20, nullable=false)
public DocumentTypes type;
@Constraints.Required
@Formats.NonEmpty
@Column(nullable=false)
public String document;
}
I match the enum using this in my controller :
DynamicForm form = form().bindFromRequest();
// ...
Document doc = new Document();
doc.type = DocumentTypes.valueOf(form.field("type").value());
doc.save();
The problem is that in database, it's stored as "Microsoft Word documents", but I would prefer to store it as DOC.
How can I do that ?
Thanks for your help! | enums | playframework-2.0 | ebean | null | null | null | open | Store enum name, not value in database using EBean
===
I have this enum :
public enum DocumentTypes {
PDF("PDF Document"), JPG("Image files (JPG)"), DOC("Microsoft Word documents");
private final String displayName;
DocumentTypes(final String display) {
this.displayName = display;
}
@Override
public String toString() {
return this.displayName;
}
}
And a model like this :
@Entity
@Table(name = "documents")
public class Document extends Model {
@Id
public Long id;
@Constraints.Required
@Formats.NonEmpty
@Enumerated(EnumType.STRING)
@Column(length=20, nullable=false)
public DocumentTypes type;
@Constraints.Required
@Formats.NonEmpty
@Column(nullable=false)
public String document;
}
I match the enum using this in my controller :
DynamicForm form = form().bindFromRequest();
// ...
Document doc = new Document();
doc.type = DocumentTypes.valueOf(form.field("type").value());
doc.save();
The problem is that in database, it's stored as "Microsoft Word documents", but I would prefer to store it as DOC.
How can I do that ?
Thanks for your help! | 0 |
11,541,442 | 07/18/2012 12:32:22 | 625,242 | 02/20/2011 13:30:30 | 1,691 | 129 | Refresh page data when button is clicked inside a usercontrol | I have a page which displays data from a web service. It first checks if the data exists in session, and then gets it from the WS if not.
My control calls the web service and adds another row to the data (an SP list in this case). If the new item was added successfully, I want to refresh the list in session. If not, no refresh is needed.
I want the page to get the new data from the web service, even if the data exists in session.
My problem is that the event handler for the button fires after the page load event of the page containing the control, where the data is retrieved and bound to a repeater.
I was thinking of using some client side tricks, like checking the event target or checking for a button name in the post params list, but my button is a server side control, and I would like it to remain that way.
Is there some best practice solution for this type of situation? | c# | asp.net | null | null | null | null | open | Refresh page data when button is clicked inside a usercontrol
===
I have a page which displays data from a web service. It first checks if the data exists in session, and then gets it from the WS if not.
My control calls the web service and adds another row to the data (an SP list in this case). If the new item was added successfully, I want to refresh the list in session. If not, no refresh is needed.
I want the page to get the new data from the web service, even if the data exists in session.
My problem is that the event handler for the button fires after the page load event of the page containing the control, where the data is retrieved and bound to a repeater.
I was thinking of using some client side tricks, like checking the event target or checking for a button name in the post params list, but my button is a server side control, and I would like it to remain that way.
Is there some best practice solution for this type of situation? | 0 |
11,541,443 | 07/18/2012 12:32:26 | 1,059,954 | 11/22/2011 14:19:11 | 328 | 11 | how to access to folder in rails | in my rails application I have uploads directory that contains audio and video files. I am using JPlayer to play audio or video as shown below
$("#jquery_jplayer_1").jPlayer({
ready: function(event) {
$(this).jPlayer("setMedia", {
mp3: "http://www.jplayer.org/audio/mp3/TSP-01-Cro_magnon_man.mp3",
});
},
swfPath: "http://www.jplayer.org/2.1.0/js",
supplied: "mp3, oga"
});
}
we see the url `mp3: "http://www.jplayer.org/audio/mp3/TSP-01-Cro_magnon_man.mp3",` I can't access to uploads directory for playing my audio and video files.
when I write `mp3: /uploads/new_audio.mp3` it doesn't play. the problem is that I set wrong url. how to access uploads directory with JQUERY How to fix this please. | jquery | ruby-on-rails | ruby | null | null | null | open | how to access to folder in rails
===
in my rails application I have uploads directory that contains audio and video files. I am using JPlayer to play audio or video as shown below
$("#jquery_jplayer_1").jPlayer({
ready: function(event) {
$(this).jPlayer("setMedia", {
mp3: "http://www.jplayer.org/audio/mp3/TSP-01-Cro_magnon_man.mp3",
});
},
swfPath: "http://www.jplayer.org/2.1.0/js",
supplied: "mp3, oga"
});
}
we see the url `mp3: "http://www.jplayer.org/audio/mp3/TSP-01-Cro_magnon_man.mp3",` I can't access to uploads directory for playing my audio and video files.
when I write `mp3: /uploads/new_audio.mp3` it doesn't play. the problem is that I set wrong url. how to access uploads directory with JQUERY How to fix this please. | 0 |
11,693,092 | 07/27/2012 17:53:39 | 778,245 | 05/31/2011 19:25:38 | 928 | 46 | Drop down menu display on image hover | I am implementing friends activity tab similar to Yahoo news as in this [link][1] on my website. It shows what your friends are doing on my website!
Please connect with facebook to see the activity tab. However, I am unable to make a proper drop-down menu where I can display the products from my website.
Can anyone redirect me to some proper plugin for the same or give some other hints
Thanks !!
[1]: http://in.news.yahoo.com/what-makes-iit-kanpur-india%E2%80%99s-best-engineering-college.html#prev | javascript | jquery | drop-down-menu | null | null | null | open | Drop down menu display on image hover
===
I am implementing friends activity tab similar to Yahoo news as in this [link][1] on my website. It shows what your friends are doing on my website!
Please connect with facebook to see the activity tab. However, I am unable to make a proper drop-down menu where I can display the products from my website.
Can anyone redirect me to some proper plugin for the same or give some other hints
Thanks !!
[1]: http://in.news.yahoo.com/what-makes-iit-kanpur-india%E2%80%99s-best-engineering-college.html#prev | 0 |
11,693,093 | 07/27/2012 17:53:45 | 1,556,583 | 07/27/2012 03:55:23 | 1 | 0 | cross browser compability | I am a developing a site at http://kolkata-web-design.co.in/MAX But though it is working properly in all the browser but it breaks in firefox.
Here is the code
header1.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >
<title>Untitled-4</title>
<script type="text/javascript" language="javascript" src="lytebox.js"></script>
<script type="text/javascript" language="javascript" src="menu.js"></script>
<link rel="stylesheet" href="lytebox.css" type="text/css" media="screen" />
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css">
<link href="max.css" rel="stylesheet" type="text/css">
<link href="lightbox/css/lightbox.css" rel="stylesheet" />
<script type="text/javascript">
$(document).ready(function() {
$(".fancybox").fancybox();
});
</script>
<style type="text/css">
body{
font-family: Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif;
}
</style>
</head>
<body>
<div class="main">
<div class="left-sidebar">
<img src="images/Max_food.jpg" width="160" height="168">
<p><img src="images/product.jpg" width="160" height="34"></p>
<form name="form1" method="post" action="products.php">
<p>
<label>
<input type="submit" name="button" id="button" value="Search">
</label>
</p>
<p> </p>
</form>
<center>
<object
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,42,0"
id="Movie2"
width="150" height="127"
>
<param name="movie" value="Movie2.swf">
<param name="bgcolor" value="#FFFFFF">
<param name="quality" value="high">
<param name="seamlesstabbing" value="false">
<param name="allowscriptaccess" value="samedomain">
<embed
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
name="Movie2"
width="150" height="127"
src="Movie2.swf"
bgcolor="#FFFFFF"
quality="high"
seamlesstabbing="false"
allowscriptaccess="samedomain"
>
<noembed>
</noembed>
</embed>
</object>
</center>
</div>
<div id="menu_background">
<table width="772">
<tr>
<td width="53" valign="top" align="center" class="top_links"><a href="index.php">Home</a></td>
<td width="1"><img src="images/divider.jpg" width="1" height="31" /></td>
<td width="77" valign="top" align="center" class="top_links"> <a href="about_us.php">About Us</a></td>
<td width="1"><img src="images/divider.jpg" width="1" height="31" /></td>
<td width="83" valign="top" align="center" class="top_links"> <a href="products.php">Our Product</a></td>
<td width="1"><img src="images/divider.jpg" width="1" height="31" /></td>
<td width="77" valign="top" align="center" class="top_links"> <a href="career.php">Career</a></td>
<td width="1"><img src="images/divider.jpg" width="1" height="31" /></td>
<td width="92" valign="top" align="center" class="top_links"> <a href="media_center.php"> Media center</a>
<td width="1"><img src="images/divider.jpg" width="1" height="31" /></td>
<td width="137" valign="top" style="margin-top:5px" align="center" class="top_links" onMouseOver="MM_showHideLayers('term','','show')" onMouseOut="MM_showHideLayers('term','','hide')"><a href="#">Terms & Condition</a>
<div style="position:relative; float:left; height:10px; visibility:hidden" onmouseover="MM_showHideLayers('term','','show')" onMouseOut="MM_showHideLayers('term','','hide')"><div id="term" style="padding:0px; margin:0px;" ><table width="200%" class="topmenu" border="0" cellspacing="0" cellpadding="0"><tr><td bgcolor="#C8E766" align="left"><ul>
<li><a href="superstokist.php"> Superstokist Application Form </a></li>
<li><a href="distributor.php">Distributor Application Form </a></li>
<li><a href="#">Terms And condition SS</a></li>
</ul></td>
</tr>
</table>
</div>
</div></td>
<td width="1"><img src="images/divider.jpg" width="1" height="31" /></td>
<td width="73" valign="top" align="center" class="top_links"> <a href="contact_us.php">Contact US</a></td>
</tr>
</table>
</div>
<div class="marque"> <marquee id="white"> Welcome to Max Group </marquee>
</div>
index.php
<? include("header1.php");
require_once("manager/includes/config.php");
?>
<div class="content">
<table border="1">
<tr>
<td width="209" height="493" valign="top">
<?
$sql="select * from content where cms_name='MAX FOOD'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
?>
<img src="images/Max_food.jpg" width="186" height="200">
<?
echo substr($row['content'],0,200)."....";
?>
</p>
<p> To know More <a href="max_food.php" style="color:#F00";>Click Here</a></p></td>
<td width="223" valign="top">
<?
$sql="select * from content where cms_name='MAX HYPER'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
?>
<img src="images/Max_hyper.jpg" width="200" height="200" />
<?
echo substr($row['content'],0,200)."....";
?>
<p> To know More <a href="max_hyper.php" style="color:#F00";>Click Here</a></p></td>
<td valign="top" width="194">
<?
$sql="select * from content where cms_name='HEALTH'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
?>
<p><img src="images/stetescope.jpg" width="193" height="200">
<?
echo substr($row['content'],0,200)."....";
?>
</p>
<p> To know More <a href="health.php" style="color:#F00";>Click Here</a></p></td>
<td width="234" valign="top">
<p><img src="images/housing.jpg" width="186" height="200">
Text Goes here Text Goes hereText Goes hereText Goes hereText Goes hereText Goes hereText Goes hereText Goes hereText </p>
<p>Click Here </p></td>
</tr>
<tr>
<td valign="top" colspan="2 "height="132"><img src="images/ourproduct.jpg" width="429" height="28">
<table width="412">
<tr>
<td width="47%"><p>
<script type="text/javascript">
// Flexible Image Slideshow- By JavaScriptKit.com (http://www.javascriptkit.com)
// For this and over 400+ free scripts, visit JavaScript Kit- http://www.javascriptkit.com/
// This notice must stay intact for use
var ultimateshow=new Array()
//ultimateshow[x]=["path to image", "OPTIONAL link for image", "OPTIONAL link target"]
ultimateshow[0]=['images/Max_food.jpg', '', '']
ultimateshow[1]=['images/Max_hyper.jpg', 'http://www.dynamicdrive.com', '_new']
//configure the below 3 variables to set the dimension/background color of the slideshow
var slidewidth="75px" //set to width of LARGEST image in your slideshow
var slideheight="75px" //set to height of LARGEST iamge in your slideshow
var slidecycles="3" //number of cycles before slideshow stops (ie: "2" or "continous")
var randomorder="no" //randomize the order in which images are displayed? "yes" or "no"
var preloadimages="yes" //preload images? "yes" or "no"
var slidebgcolor='white'
//configure the below variable to determine the delay between image rotations (in miliseconds)
var slidedelay=3000
////Do not edit pass this line////////////////
var ie=document.all
var dom=document.getElementById
var curcycle=0
if (preloadimages=="yes"){
for (i=0;i<ultimateshow.length;i++){
var cacheimage=new Image()
cacheimage.src=ultimateshow[i][0]
}
}
var currentslide=0
function randomize(targetarray){
ultimateshowCopy=new Array()
var the_one
var z=0
while (z<targetarray.length){
the_one=Math.floor(Math.random()*targetarray.length)
if (targetarray[the_one]!="_selected!"){
ultimateshowCopy[z]=targetarray[the_one]
targetarray[the_one]="_selected!"
z++
}
}
}
if (randomorder=="yes")
randomize(ultimateshow)
else
ultimateshowCopy=ultimateshow
function rotateimages(){
curcycle=(currentslide==0)? curcycle+1 : curcycle
ultcontainer='<center>'
if (ultimateshowCopy[currentslide][1]!="")
ultcontainer+='<a href="'+ultimateshowCopy[currentslide][1]+'" target="'+ultimateshowCopy[currentslide][2]+'">'
ultcontainer+='<img src="'+ultimateshowCopy[currentslide][0]+'" width="100" height="100" border="0">'
if (ultimateshowCopy[currentslide][1]!="")
ultcontainer+='</a>'
ultcontainer+='</center>'
if (ie||dom)
crossrotateobj.innerHTML=ultcontainer
if (currentslide==ultimateshow.length-1) currentslide=0
else currentslide++
if (curcycle==parseInt(slidecycles) && currentslide==0)
return
setTimeout("rotateimages()",slidedelay)
}
if (ie||dom)
document.write('<div id="slidedom" style="width:'+100+';height:'+100+'; background-color:'+slidebgcolor+'"></div>')
function start_slider(){
crossrotateobj=dom? document.getElementById("slidedom") : document.all.slidedom
rotateimages()
}
if (ie||dom)
window.onload=start_slider
</script>
</p></td>
<td valign="top" width="53%"><p>We Have no. of products to show please click here</p></td>
</tr>
</table></td>
<td valign="top" colspan="2" height="132"><img src="images/ourachievement.jpg" width="408" height="29" /></td>
</tr>
</table>
</div>
<? include("footer.php") ?>
footer.php
<hr color="#FF0000" />
<div id="footer" style="background-color:#CCC; margin-top: -16px; border-bottom:thick #F00; width:1024px; height:60px">
<p>Site deigned and programmed by Kolkata web Design </p>
</div>
</body>
</html>
max.css
@charset "utf-8";
/* CSS Document */
.heading
{
font-weight:bold; font-size:25px
}
.heading-sub
{
font-weight:bold; font-size:25px; color:#F00
}
.text
{
font-size:12px; color: #000
}
.top_links a {
font-family: Verdana;
font-weight: bold;
font-size: 11px;
display:block;
text-decoration: none;
color: black;
}
.top_links a:hover { COLOR: red; font-style:italic; font-weight: bold; font-size:12px; }
.top_links{
top:10%;
position: relative;
border-right:thin;
}
.top_links ul {
font-family: Verdana;
position:relative;
font-weight: bold;
font-size: 11px;
display: block;
line-height: 35px;
text-decoration: none;
z-index:5;
color: black;
}
.mar {
color: #FFF;
}
#white {
color: #FFF;
}
#white {
color: #FFF;
}
.main{
border:medium;
width:1024px;
height:800px;
}
.left-sidebar
{
float:left;
width:160px;
height:700px;
border-right:solid;
margin-top: -9px; /*half of the height*/
}
#menu_background
{
float:left;
margin:0 auto;
width:845px;
height:30px;
border-bottom:none;
background:url(images/MAX_02.gif) repeat-x;margin-top: -10px; /*half of the height*/
z-index:0;
}
.marque
{
float:left;
background-image:url(images/MAX_03.gif);
width:845px;
height:31px;
z-index:10;
}
#content
{
float:left;
border:medium;
width:800px;
height:500px;
z-index:-5;
}
div.scroll
{
background-color:white;
width:830px;
height:500px;
overflow:scroll;
}
Please Help me sir in this case as i cannot find the right solution why this is happening
Thanks
Sodmeb
| php | html | css | null | null | 07/27/2012 17:57:07 | not a real question | cross browser compability
===
I am a developing a site at http://kolkata-web-design.co.in/MAX But though it is working properly in all the browser but it breaks in firefox.
Here is the code
header1.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >
<title>Untitled-4</title>
<script type="text/javascript" language="javascript" src="lytebox.js"></script>
<script type="text/javascript" language="javascript" src="menu.js"></script>
<link rel="stylesheet" href="lytebox.css" type="text/css" media="screen" />
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css">
<link href="max.css" rel="stylesheet" type="text/css">
<link href="lightbox/css/lightbox.css" rel="stylesheet" />
<script type="text/javascript">
$(document).ready(function() {
$(".fancybox").fancybox();
});
</script>
<style type="text/css">
body{
font-family: Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif;
}
</style>
</head>
<body>
<div class="main">
<div class="left-sidebar">
<img src="images/Max_food.jpg" width="160" height="168">
<p><img src="images/product.jpg" width="160" height="34"></p>
<form name="form1" method="post" action="products.php">
<p>
<label>
<input type="submit" name="button" id="button" value="Search">
</label>
</p>
<p> </p>
</form>
<center>
<object
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,42,0"
id="Movie2"
width="150" height="127"
>
<param name="movie" value="Movie2.swf">
<param name="bgcolor" value="#FFFFFF">
<param name="quality" value="high">
<param name="seamlesstabbing" value="false">
<param name="allowscriptaccess" value="samedomain">
<embed
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
name="Movie2"
width="150" height="127"
src="Movie2.swf"
bgcolor="#FFFFFF"
quality="high"
seamlesstabbing="false"
allowscriptaccess="samedomain"
>
<noembed>
</noembed>
</embed>
</object>
</center>
</div>
<div id="menu_background">
<table width="772">
<tr>
<td width="53" valign="top" align="center" class="top_links"><a href="index.php">Home</a></td>
<td width="1"><img src="images/divider.jpg" width="1" height="31" /></td>
<td width="77" valign="top" align="center" class="top_links"> <a href="about_us.php">About Us</a></td>
<td width="1"><img src="images/divider.jpg" width="1" height="31" /></td>
<td width="83" valign="top" align="center" class="top_links"> <a href="products.php">Our Product</a></td>
<td width="1"><img src="images/divider.jpg" width="1" height="31" /></td>
<td width="77" valign="top" align="center" class="top_links"> <a href="career.php">Career</a></td>
<td width="1"><img src="images/divider.jpg" width="1" height="31" /></td>
<td width="92" valign="top" align="center" class="top_links"> <a href="media_center.php"> Media center</a>
<td width="1"><img src="images/divider.jpg" width="1" height="31" /></td>
<td width="137" valign="top" style="margin-top:5px" align="center" class="top_links" onMouseOver="MM_showHideLayers('term','','show')" onMouseOut="MM_showHideLayers('term','','hide')"><a href="#">Terms & Condition</a>
<div style="position:relative; float:left; height:10px; visibility:hidden" onmouseover="MM_showHideLayers('term','','show')" onMouseOut="MM_showHideLayers('term','','hide')"><div id="term" style="padding:0px; margin:0px;" ><table width="200%" class="topmenu" border="0" cellspacing="0" cellpadding="0"><tr><td bgcolor="#C8E766" align="left"><ul>
<li><a href="superstokist.php"> Superstokist Application Form </a></li>
<li><a href="distributor.php">Distributor Application Form </a></li>
<li><a href="#">Terms And condition SS</a></li>
</ul></td>
</tr>
</table>
</div>
</div></td>
<td width="1"><img src="images/divider.jpg" width="1" height="31" /></td>
<td width="73" valign="top" align="center" class="top_links"> <a href="contact_us.php">Contact US</a></td>
</tr>
</table>
</div>
<div class="marque"> <marquee id="white"> Welcome to Max Group </marquee>
</div>
index.php
<? include("header1.php");
require_once("manager/includes/config.php");
?>
<div class="content">
<table border="1">
<tr>
<td width="209" height="493" valign="top">
<?
$sql="select * from content where cms_name='MAX FOOD'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
?>
<img src="images/Max_food.jpg" width="186" height="200">
<?
echo substr($row['content'],0,200)."....";
?>
</p>
<p> To know More <a href="max_food.php" style="color:#F00";>Click Here</a></p></td>
<td width="223" valign="top">
<?
$sql="select * from content where cms_name='MAX HYPER'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
?>
<img src="images/Max_hyper.jpg" width="200" height="200" />
<?
echo substr($row['content'],0,200)."....";
?>
<p> To know More <a href="max_hyper.php" style="color:#F00";>Click Here</a></p></td>
<td valign="top" width="194">
<?
$sql="select * from content where cms_name='HEALTH'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
?>
<p><img src="images/stetescope.jpg" width="193" height="200">
<?
echo substr($row['content'],0,200)."....";
?>
</p>
<p> To know More <a href="health.php" style="color:#F00";>Click Here</a></p></td>
<td width="234" valign="top">
<p><img src="images/housing.jpg" width="186" height="200">
Text Goes here Text Goes hereText Goes hereText Goes hereText Goes hereText Goes hereText Goes hereText Goes hereText </p>
<p>Click Here </p></td>
</tr>
<tr>
<td valign="top" colspan="2 "height="132"><img src="images/ourproduct.jpg" width="429" height="28">
<table width="412">
<tr>
<td width="47%"><p>
<script type="text/javascript">
// Flexible Image Slideshow- By JavaScriptKit.com (http://www.javascriptkit.com)
// For this and over 400+ free scripts, visit JavaScript Kit- http://www.javascriptkit.com/
// This notice must stay intact for use
var ultimateshow=new Array()
//ultimateshow[x]=["path to image", "OPTIONAL link for image", "OPTIONAL link target"]
ultimateshow[0]=['images/Max_food.jpg', '', '']
ultimateshow[1]=['images/Max_hyper.jpg', 'http://www.dynamicdrive.com', '_new']
//configure the below 3 variables to set the dimension/background color of the slideshow
var slidewidth="75px" //set to width of LARGEST image in your slideshow
var slideheight="75px" //set to height of LARGEST iamge in your slideshow
var slidecycles="3" //number of cycles before slideshow stops (ie: "2" or "continous")
var randomorder="no" //randomize the order in which images are displayed? "yes" or "no"
var preloadimages="yes" //preload images? "yes" or "no"
var slidebgcolor='white'
//configure the below variable to determine the delay between image rotations (in miliseconds)
var slidedelay=3000
////Do not edit pass this line////////////////
var ie=document.all
var dom=document.getElementById
var curcycle=0
if (preloadimages=="yes"){
for (i=0;i<ultimateshow.length;i++){
var cacheimage=new Image()
cacheimage.src=ultimateshow[i][0]
}
}
var currentslide=0
function randomize(targetarray){
ultimateshowCopy=new Array()
var the_one
var z=0
while (z<targetarray.length){
the_one=Math.floor(Math.random()*targetarray.length)
if (targetarray[the_one]!="_selected!"){
ultimateshowCopy[z]=targetarray[the_one]
targetarray[the_one]="_selected!"
z++
}
}
}
if (randomorder=="yes")
randomize(ultimateshow)
else
ultimateshowCopy=ultimateshow
function rotateimages(){
curcycle=(currentslide==0)? curcycle+1 : curcycle
ultcontainer='<center>'
if (ultimateshowCopy[currentslide][1]!="")
ultcontainer+='<a href="'+ultimateshowCopy[currentslide][1]+'" target="'+ultimateshowCopy[currentslide][2]+'">'
ultcontainer+='<img src="'+ultimateshowCopy[currentslide][0]+'" width="100" height="100" border="0">'
if (ultimateshowCopy[currentslide][1]!="")
ultcontainer+='</a>'
ultcontainer+='</center>'
if (ie||dom)
crossrotateobj.innerHTML=ultcontainer
if (currentslide==ultimateshow.length-1) currentslide=0
else currentslide++
if (curcycle==parseInt(slidecycles) && currentslide==0)
return
setTimeout("rotateimages()",slidedelay)
}
if (ie||dom)
document.write('<div id="slidedom" style="width:'+100+';height:'+100+'; background-color:'+slidebgcolor+'"></div>')
function start_slider(){
crossrotateobj=dom? document.getElementById("slidedom") : document.all.slidedom
rotateimages()
}
if (ie||dom)
window.onload=start_slider
</script>
</p></td>
<td valign="top" width="53%"><p>We Have no. of products to show please click here</p></td>
</tr>
</table></td>
<td valign="top" colspan="2" height="132"><img src="images/ourachievement.jpg" width="408" height="29" /></td>
</tr>
</table>
</div>
<? include("footer.php") ?>
footer.php
<hr color="#FF0000" />
<div id="footer" style="background-color:#CCC; margin-top: -16px; border-bottom:thick #F00; width:1024px; height:60px">
<p>Site deigned and programmed by Kolkata web Design </p>
</div>
</body>
</html>
max.css
@charset "utf-8";
/* CSS Document */
.heading
{
font-weight:bold; font-size:25px
}
.heading-sub
{
font-weight:bold; font-size:25px; color:#F00
}
.text
{
font-size:12px; color: #000
}
.top_links a {
font-family: Verdana;
font-weight: bold;
font-size: 11px;
display:block;
text-decoration: none;
color: black;
}
.top_links a:hover { COLOR: red; font-style:italic; font-weight: bold; font-size:12px; }
.top_links{
top:10%;
position: relative;
border-right:thin;
}
.top_links ul {
font-family: Verdana;
position:relative;
font-weight: bold;
font-size: 11px;
display: block;
line-height: 35px;
text-decoration: none;
z-index:5;
color: black;
}
.mar {
color: #FFF;
}
#white {
color: #FFF;
}
#white {
color: #FFF;
}
.main{
border:medium;
width:1024px;
height:800px;
}
.left-sidebar
{
float:left;
width:160px;
height:700px;
border-right:solid;
margin-top: -9px; /*half of the height*/
}
#menu_background
{
float:left;
margin:0 auto;
width:845px;
height:30px;
border-bottom:none;
background:url(images/MAX_02.gif) repeat-x;margin-top: -10px; /*half of the height*/
z-index:0;
}
.marque
{
float:left;
background-image:url(images/MAX_03.gif);
width:845px;
height:31px;
z-index:10;
}
#content
{
float:left;
border:medium;
width:800px;
height:500px;
z-index:-5;
}
div.scroll
{
background-color:white;
width:830px;
height:500px;
overflow:scroll;
}
Please Help me sir in this case as i cannot find the right solution why this is happening
Thanks
Sodmeb
| 1 |
11,693,094 | 07/27/2012 17:54:19 | 88,092 | 04/07/2009 12:48:48 | 2,846 | 147 | How to treat all Service Reference return types the same | I have a Silverlight project which references a handful of web services. Each web service method returns a standard response wrapper object called `GenericWebResponse`. This class contains information about whether or no the call was successful, and some status codes if it failed to indicate why it failed. Common things are that the authentication ticket expired, or the user doesn't have permission to perform the action.
Anyway, whenever a web service call fails, I want to treat it the same way. I want to create a log entry, notify the user something went wrong, etc.
Since I have multiple services, each service reference generates a new instance of the same `GenericWebResponse` class. So I have `ProductService.GenericWebResponse` and `OrderService.GenericWebResponse`, and obviously .NET treats them as entirely separate classes.
I want a way to write code against these objects generically. I know that the response will always be the same, but .NET doesn't know that. I get that. But is there some way I can write code against these objects so that I don't have to write an new version of my failure logging code for each service I have? | .net | silverlight | asmx | service-reference | null | null | open | How to treat all Service Reference return types the same
===
I have a Silverlight project which references a handful of web services. Each web service method returns a standard response wrapper object called `GenericWebResponse`. This class contains information about whether or no the call was successful, and some status codes if it failed to indicate why it failed. Common things are that the authentication ticket expired, or the user doesn't have permission to perform the action.
Anyway, whenever a web service call fails, I want to treat it the same way. I want to create a log entry, notify the user something went wrong, etc.
Since I have multiple services, each service reference generates a new instance of the same `GenericWebResponse` class. So I have `ProductService.GenericWebResponse` and `OrderService.GenericWebResponse`, and obviously .NET treats them as entirely separate classes.
I want a way to write code against these objects generically. I know that the response will always be the same, but .NET doesn't know that. I get that. But is there some way I can write code against these objects so that I don't have to write an new version of my failure logging code for each service I have? | 0 |
11,692,741 | 07/27/2012 17:30:12 | 1,558,328 | 07/27/2012 17:19:41 | 1 | 0 | ttk treeview tag_has | I am working on a project using Python with Tkinter as a GUI. My design makes use of the ttk Treeview widget. One of my functions calls the included tree view method 'tag_has' (documented here: <http://www.tcl.tk/man/tcl/TkCmd/ttk_treeview.htm#M57>).
This function works great when running under OSX, however when I attempt to run my program on a Win 7 platform, I get 'TclError: bad command "has": must be bind or configure'.
I am running ActiveState versions of Python and Tk on both devices. Any ideas on how I can fix this? | python | treeview | tkinter | tk | ttk | null | open | ttk treeview tag_has
===
I am working on a project using Python with Tkinter as a GUI. My design makes use of the ttk Treeview widget. One of my functions calls the included tree view method 'tag_has' (documented here: <http://www.tcl.tk/man/tcl/TkCmd/ttk_treeview.htm#M57>).
This function works great when running under OSX, however when I attempt to run my program on a Win 7 platform, I get 'TclError: bad command "has": must be bind or configure'.
I am running ActiveState versions of Python and Tk on both devices. Any ideas on how I can fix this? | 0 |
11,692,743 | 07/27/2012 17:30:34 | 549,840 | 12/21/2010 11:29:57 | 94 | 2 | loop through json inside json | I have an jSon collection, and inside each item I have other colection:
I'm walking in the first jSon item:
$.each(data, function (index, element) {
var tmp = $('#itemBusca').html();
$('#buscas').append(_.template(tmp, element));
});
I need to walk inside an collection that exists inside the actual item.
How I do this?
Best Regards,
Milton | jquery | json | null | null | null | null | open | loop through json inside json
===
I have an jSon collection, and inside each item I have other colection:
I'm walking in the first jSon item:
$.each(data, function (index, element) {
var tmp = $('#itemBusca').html();
$('#buscas').append(_.template(tmp, element));
});
I need to walk inside an collection that exists inside the actual item.
How I do this?
Best Regards,
Milton | 0 |
11,693,101 | 07/27/2012 17:54:36 | 1,557,983 | 07/27/2012 14:41:30 | 1 | 0 | Important, or just Personal Preference? | I have an extension method that returns stuff (strings, lists, bools, etc), and I usually write them like this:
public string Return(string firstName)
{
/* get first name
*/
string fname = result.FirstName;
return fname;
}
You'll notice that I declared a new variable "fname", and returned it.
But lately I've been doing this:
public string Return(string firstName)
{
/* code to get first name
*/
firstName = result.FirstName;
return firstName;
}
Which turns out to work the same way.
And while writing this question, I remembered that I can just do this:
public string Return(string firstName)
{
/* code to get first name
*/
return result.FirstName;
}
Does it really matter which way you write this, or does it just come down to personal preference? | c# | language-agnostic | syntax | programming-languages | null | 07/27/2012 18:15:40 | not constructive | Important, or just Personal Preference?
===
I have an extension method that returns stuff (strings, lists, bools, etc), and I usually write them like this:
public string Return(string firstName)
{
/* get first name
*/
string fname = result.FirstName;
return fname;
}
You'll notice that I declared a new variable "fname", and returned it.
But lately I've been doing this:
public string Return(string firstName)
{
/* code to get first name
*/
firstName = result.FirstName;
return firstName;
}
Which turns out to work the same way.
And while writing this question, I remembered that I can just do this:
public string Return(string firstName)
{
/* code to get first name
*/
return result.FirstName;
}
Does it really matter which way you write this, or does it just come down to personal preference? | 4 |
11,593,541 | 07/21/2012 15:40:41 | 1,190,417 | 02/05/2012 09:16:52 | 103 | 4 | How to add buttons to a NSSplitter handle? | Is it possible to add buttons, or to draw inside the handle of an NSSplitter ?
I don't only want to draw over the control like it's done in XCode (for errors handling, see second image); I also want to add features to the split view. For example, in this case, I would like the double arrow to swap the two views.
![A mockup of my idea][1]
![An line draw in the scroll bar][2]
[1]: http://i.stack.imgur.com/Ig0Ek.png
[2]: http://i.stack.imgur.com/LwdEq.png | cocoa | null | null | null | null | null | open | How to add buttons to a NSSplitter handle?
===
Is it possible to add buttons, or to draw inside the handle of an NSSplitter ?
I don't only want to draw over the control like it's done in XCode (for errors handling, see second image); I also want to add features to the split view. For example, in this case, I would like the double arrow to swap the two views.
![A mockup of my idea][1]
![An line draw in the scroll bar][2]
[1]: http://i.stack.imgur.com/Ig0Ek.png
[2]: http://i.stack.imgur.com/LwdEq.png | 0 |
11,593,745 | 07/21/2012 16:07:15 | 1,542,890 | 07/21/2012 15:56:33 | 1 | 0 | PXE server library for C# project | Is there any free PXE server library for .net.
Well i know some pxe programs like tftpd32 but its in c++ & dont know anything abt how to use it in c#.
if anybody can provide sample code to use it. (tftp32 or any other)
Thx. This is great site.Always Solved many questions of mine. | c# | null | null | null | null | null | open | PXE server library for C# project
===
Is there any free PXE server library for .net.
Well i know some pxe programs like tftpd32 but its in c++ & dont know anything abt how to use it in c#.
if anybody can provide sample code to use it. (tftp32 or any other)
Thx. This is great site.Always Solved many questions of mine. | 0 |
11,594,231 | 07/21/2012 17:13:14 | 1,542,976 | 07/21/2012 17:10:20 | 1 | 0 | How to categorize and count imported data |
Suppose there’s a sensor which records the date and time at every activation. I have this data stored as a list in a .json file in the format (e.g.) "2000-01-01T00:30:15+00:00".
Now, what I want to do is import this file in python and use NumPy/ Mathplotlib to plot how many times this sensor is activated per day.
My problem is, using this data, I don’t know how to write an algorithm which counts how many times the sensor is activated daily. (This should be simple, but due to limited Python knowledge, I’m stuck). Supposedly there is a way to split this list wrt T, bin each recording by date (e.g. “2000-01-01”) and then count the recordings on this date.
How would you count how many times the sensor is activated? (to then make a plot showing the number of activations each day?)
| python | numpy | null | null | null | null | open | How to categorize and count imported data
===
Suppose there’s a sensor which records the date and time at every activation. I have this data stored as a list in a .json file in the format (e.g.) "2000-01-01T00:30:15+00:00".
Now, what I want to do is import this file in python and use NumPy/ Mathplotlib to plot how many times this sensor is activated per day.
My problem is, using this data, I don’t know how to write an algorithm which counts how many times the sensor is activated daily. (This should be simple, but due to limited Python knowledge, I’m stuck). Supposedly there is a way to split this list wrt T, bin each recording by date (e.g. “2000-01-01”) and then count the recordings on this date.
How would you count how many times the sensor is activated? (to then make a plot showing the number of activations each day?)
| 0 |
11,225,583 | 06/27/2012 11:53:45 | 1,228,454 | 02/23/2012 13:30:15 | 2,429 | 116 | HTML Entities with Knockout | How can I output HTML Entities in fields that are bound to a variable in the viewModel? I would like to display an HTML Entity like ← (`←`) in a field bound to a `span` in the HTML. Unfortunately, the HTML is escaped, so the browser displays &larr; instead of the symbol.
Fiddle with an example:
http://jsfiddle.net/nwinkler/KES2j/
| javascript | knockout.js | null | null | null | null | open | HTML Entities with Knockout
===
How can I output HTML Entities in fields that are bound to a variable in the viewModel? I would like to display an HTML Entity like ← (`←`) in a field bound to a `span` in the HTML. Unfortunately, the HTML is escaped, so the browser displays &larr; instead of the symbol.
Fiddle with an example:
http://jsfiddle.net/nwinkler/KES2j/
| 0 |
11,226,653 | 06/27/2012 12:52:59 | 1,485,658 | 06/27/2012 12:37:47 | 1 | 0 | how to write use case diagram and description for tow user | how to write use case diagram and description for tow user A and B do the same use case but user B can do things in use case not available to A | use-case | null | null | null | null | null | open | how to write use case diagram and description for tow user
===
how to write use case diagram and description for tow user A and B do the same use case but user B can do things in use case not available to A | 0 |
11,226,654 | 06/27/2012 12:53:02 | 985,369 | 10/08/2011 13:07:12 | 194 | 19 | Android shell read and write permission command for particular file? | i have tried to give read and write permission to a file which i have moved to /data/local folder in android, But get succeeded.
Have tried the following commands :
String[] str ={"su","-c","cp mnt/sdcard/asl-native /data/local/asl-native","/system/bin/chmod 7555 /data/local/asl-native"/*,"/system/bin/chmod 0777 /data/local/asl-native"*/};
String[] str1 ={"su","mount -o remount,rw /data/local/asl-native"};
String[] str2={"su","chmod -R UGO /data/local"};
String[] str3={"chmod ug+rw /data/local/"};
// chmod -R 0777 /mydirectory
// $ chmod ug+rw mydir
// $ ls -ld mydir
// drw-rw---- 2 unixguy uguys 96 Dec 8 12:53 mydir
try {
p = Runtime.getRuntime().exec(str3);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
if(p.waitFor()==127 || p.waitFor()==255){
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Please help me to achieve it .
Thanks ,
Rajesh .
| android | shell | null | null | null | null | open | Android shell read and write permission command for particular file?
===
i have tried to give read and write permission to a file which i have moved to /data/local folder in android, But get succeeded.
Have tried the following commands :
String[] str ={"su","-c","cp mnt/sdcard/asl-native /data/local/asl-native","/system/bin/chmod 7555 /data/local/asl-native"/*,"/system/bin/chmod 0777 /data/local/asl-native"*/};
String[] str1 ={"su","mount -o remount,rw /data/local/asl-native"};
String[] str2={"su","chmod -R UGO /data/local"};
String[] str3={"chmod ug+rw /data/local/"};
// chmod -R 0777 /mydirectory
// $ chmod ug+rw mydir
// $ ls -ld mydir
// drw-rw---- 2 unixguy uguys 96 Dec 8 12:53 mydir
try {
p = Runtime.getRuntime().exec(str3);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
if(p.waitFor()==127 || p.waitFor()==255){
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Please help me to achieve it .
Thanks ,
Rajesh .
| 0 |
11,226,655 | 06/27/2012 12:53:03 | 1,485,637 | 06/27/2012 12:30:37 | 1 | 0 | Using wget to get a specific folder (from FTP) and mirror that folder in a specific folder on my server | I have read around and cannot seem to get the result that I need. Basically, I am using a cron job on my webserver to log into a remote FTP site and get an entire folder of files, and put them in a specific folder on my web server. My latest attempt is getting me close, but it does not seem to be recognizing new files, but rather only looking at the files that were originally there. As a result, the new files aren't being brought over. Does anyone see a problem with my cron command?
wget --user=xxxxxxxxx --password='xxxxxxxxx' ftp://ftp.xxxxxxxxx.com/Test/ -r -m -nH --cut-dirs=2 -P ~/public_html/xxxxxxxx/xxxxxxxx/Images/"Primary Images"/ | ftp | cron | wget | null | null | null | open | Using wget to get a specific folder (from FTP) and mirror that folder in a specific folder on my server
===
I have read around and cannot seem to get the result that I need. Basically, I am using a cron job on my webserver to log into a remote FTP site and get an entire folder of files, and put them in a specific folder on my web server. My latest attempt is getting me close, but it does not seem to be recognizing new files, but rather only looking at the files that were originally there. As a result, the new files aren't being brought over. Does anyone see a problem with my cron command?
wget --user=xxxxxxxxx --password='xxxxxxxxx' ftp://ftp.xxxxxxxxx.com/Test/ -r -m -nH --cut-dirs=2 -P ~/public_html/xxxxxxxx/xxxxxxxx/Images/"Primary Images"/ | 0 |
11,226,585 | 06/27/2012 12:48:19 | 970,785 | 09/29/2011 09:16:35 | 39 | 5 | For split String using regex in java | date=2011-07-08 time=10:55:06 timezone="IST" device_name="CR1000i" device_id=C010600504-TYGJD3 deployment_mode="Route" log_id=031006209001 log_type="Anti Virus" log_component="FTP" log_subtype="Clean" status="Denied" priority=Critical fw_rule_id="" user_name="hemant" virus="codevirus" FTP_URL="ftp.myftp.com" FTP_direction="download" filename="hemantresume.doc" file_size="550k" file_path="deepti/Shortcut to virus.lnk" ftpcommand="RETR" src_ip=10.103.6.100 dst_ip=10.103.6.66 protocol="TCP" src_port=2458 dst_port=21 dstdomain="myftp.cpm" sent_bytes=162 recv_bytes=45 message="An FTP download of File resume.doc of size 550k from server ftp.myftp.com could not be completed as file was infected with virus codevirus"
Now i want the above string is split and give me the output based on the key-value pairs as below:
array[0]=date=2011-07-08
array[1]=time=10:55:06
array[2]=timezone="IST"
array[3]=device_name='CR1000i"
.......
.......
so please help me..thanks
| java | regex | patterns | string-matching | null | 06/28/2012 13:44:07 | not a real question | For split String using regex in java
===
date=2011-07-08 time=10:55:06 timezone="IST" device_name="CR1000i" device_id=C010600504-TYGJD3 deployment_mode="Route" log_id=031006209001 log_type="Anti Virus" log_component="FTP" log_subtype="Clean" status="Denied" priority=Critical fw_rule_id="" user_name="hemant" virus="codevirus" FTP_URL="ftp.myftp.com" FTP_direction="download" filename="hemantresume.doc" file_size="550k" file_path="deepti/Shortcut to virus.lnk" ftpcommand="RETR" src_ip=10.103.6.100 dst_ip=10.103.6.66 protocol="TCP" src_port=2458 dst_port=21 dstdomain="myftp.cpm" sent_bytes=162 recv_bytes=45 message="An FTP download of File resume.doc of size 550k from server ftp.myftp.com could not be completed as file was infected with virus codevirus"
Now i want the above string is split and give me the output based on the key-value pairs as below:
array[0]=date=2011-07-08
array[1]=time=10:55:06
array[2]=timezone="IST"
array[3]=device_name='CR1000i"
.......
.......
so please help me..thanks
| 1 |
11,226,668 | 06/27/2012 12:53:56 | 1,485,663 | 06/27/2012 12:39:37 | 1 | 0 | Perltk - remembering the position in Text widget | I just wrote a very simple perl tk script to read a huge text file and display it with Text widget and attached it to Scrollbar widget. Now my problem is that each time i run the script , it displays from the first sentence ( of the whole text file ) onwards. How can i make the script remember my position in the text and display the same area when i quite and start the script again *i.e* if i read the 1ooo th line of the text and quite the script, script should show the 1000th line onwards when i again run it. ( or in other words remember the scroll position)
I am not a professional in perl tk nor perl but trying my best to learn it. Please give a reply which good be understood . | perl | perltk | null | null | null | null | open | Perltk - remembering the position in Text widget
===
I just wrote a very simple perl tk script to read a huge text file and display it with Text widget and attached it to Scrollbar widget. Now my problem is that each time i run the script , it displays from the first sentence ( of the whole text file ) onwards. How can i make the script remember my position in the text and display the same area when i quite and start the script again *i.e* if i read the 1ooo th line of the text and quite the script, script should show the 1000th line onwards when i again run it. ( or in other words remember the scroll position)
I am not a professional in perl tk nor perl but trying my best to learn it. Please give a reply which good be understood . | 0 |
11,226,669 | 06/27/2012 12:53:58 | 368,364 | 06/16/2010 14:52:22 | 3,622 | 120 | Delphi - hook\bypass\catch all the outputdebugstrings from the system into my application with process id and process name | based on [this question][1] I've created a small application which is catching all debug strings into my application. code of the thread is showed bellow. What I want is to get the process id and it's name for each debug string I got. After I've made some research I got this [article][2] where it says: "The first 4 bytes (32-bit DWORD) is the process ID of the process that wrote the text using OutputDebugString.". I have tried to get the process by calling the functions bellow but the result is null
TempString := '';
CopyMemory(PChar(TempString),SharedMemory,sizeof(SharedMemory));// - returns 0....
TempString := String(PAnsiChar(SharedMemory)+ SizeOf(DWORD));
I do not know what it is wrong.
Also it is possible to get the name of the process which has sent the debug string?
thread code:
interface
uses Classes,
windows,
Forms,
StdCtrls,
SysUtils;
type
TDebugStringThread = class(TThread)
private
FMemo : TMemo;
protected
procedure Execute; override;
procedure DoShowData;
procedure DoShowErrors;
public
constructor Create(aMemo : TMemo);
end;
implementation
var SharedMessage: string;
ErrsMess : String;
constructor TDebugStringThread.Create(aMemo: TMemo);
begin
FMemo := aMemo;
FreeOnTerminate := True;
inherited Create(False);
end;
procedure TDebugStringThread.DoShowData;
begin
FMemo.Lines.Add(SharedMessage);
end;
procedure TDebugStringThread.DoShowErrors;
begin
FMemo.Lines.Add('Error '+ ErrsMess);
ErrsMess := '';
end;
procedure TDebugStringThread.Execute;
var SharedMem: Pointer;
SharedFile: THandle;
WaitingResult: DWORD;
DataReadyEvent: THandle;
BufferReadyEvent: THandle;
SecurityAttributes: SECURITY_ATTRIBUTES;
SecurityDescriptor: SECURITY_DESCRIPTOR;
SharedMemory : Pointer;
TempString : String;
begin
ErrsMess := '';
SecurityAttributes.nLength := SizeOf(SECURITY_ATTRIBUTES);
SecurityAttributes.bInheritHandle := True;
SecurityAttributes.lpSecurityDescriptor := @SecurityDescriptor;
if not InitializeSecurityDescriptor(@SecurityDescriptor, SECURITY_DESCRIPTOR_REVISION) then
Exit;
if not SetSecurityDescriptorDacl(@SecurityDescriptor, True, nil, False) then
Exit;
BufferReadyEvent := CreateEvent(@SecurityAttributes, False, True, 'DBWIN_BUFFER_READY');
if BufferReadyEvent = 0 then
Exit;
DataReadyEvent := CreateEvent(@SecurityAttributes, False, False, 'DBWIN_DATA_READY');
if DataReadyEvent = 0 then
Exit;
SharedFile := CreateFileMapping(THandle(-1), @SecurityAttributes, PAGE_READWRITE, 0, 4096, 'Global\DBWIN_BUFFER');
if SharedFile = 0 then
begin
ErrsMess := SysErrorMessage(GetLastError);
Synchronize(DoShowErrors);
Exit;
end;
SharedMem := MapViewOfFile(SharedFile, FILE_MAP_READ, 0, 0, 512);
SharedMemory := MapViewOfFile(SharedFile,SECTION_MAP_READ,0, 0, 1024);
if not Assigned(SharedMem) then
begin
ErrsMess := SysErrorMessage(GetLastError);
Synchronize(DoShowErrors);
Exit;
end;
if not Assigned(SharedMemory) then
begin
ErrsMess := SysErrorMessage(GetLastError);
Synchronize(DoShowErrors);
end;
while (not Terminated) and (not Application.Terminated) do
begin
SetEvent(BufferReadyEvent);
WaitingResult := WaitForSingleObject(DataReadyEvent, INFINITE);
case WaitingResult of
WAIT_TIMEOUT: Continue;
WAIT_OBJECT_0:
begin
try
TempString := '';
//CopyMemory(PChar(TempString),SharedMemory,sizeof(SharedMemory));// - returns 0....
TempString := String(PAnsiChar(SharedMemory)+ SizeOf(DWORD));
SharedMessage := TempString +' '+ String(PAnsiChar(SharedMem) + SizeOf(DWORD));
Synchronize(DoShowData);
finally
end;
end;
WAIT_FAILED: Continue;
end;
end;
UnmapViewOfFile(SharedMem);
CloseHandle(SharedFile);
end;
end.
[1]: http://stackoverflow.com/questions/6384785/how-can-i-receive-outputdebugstring-from-service
[2]: http://philondev.blogspot.ro/2009/12/monitoring-outputdebugstring-on-windows.html | delphi | delphi-xe | outputdebugstring | null | null | null | open | Delphi - hook\bypass\catch all the outputdebugstrings from the system into my application with process id and process name
===
based on [this question][1] I've created a small application which is catching all debug strings into my application. code of the thread is showed bellow. What I want is to get the process id and it's name for each debug string I got. After I've made some research I got this [article][2] where it says: "The first 4 bytes (32-bit DWORD) is the process ID of the process that wrote the text using OutputDebugString.". I have tried to get the process by calling the functions bellow but the result is null
TempString := '';
CopyMemory(PChar(TempString),SharedMemory,sizeof(SharedMemory));// - returns 0....
TempString := String(PAnsiChar(SharedMemory)+ SizeOf(DWORD));
I do not know what it is wrong.
Also it is possible to get the name of the process which has sent the debug string?
thread code:
interface
uses Classes,
windows,
Forms,
StdCtrls,
SysUtils;
type
TDebugStringThread = class(TThread)
private
FMemo : TMemo;
protected
procedure Execute; override;
procedure DoShowData;
procedure DoShowErrors;
public
constructor Create(aMemo : TMemo);
end;
implementation
var SharedMessage: string;
ErrsMess : String;
constructor TDebugStringThread.Create(aMemo: TMemo);
begin
FMemo := aMemo;
FreeOnTerminate := True;
inherited Create(False);
end;
procedure TDebugStringThread.DoShowData;
begin
FMemo.Lines.Add(SharedMessage);
end;
procedure TDebugStringThread.DoShowErrors;
begin
FMemo.Lines.Add('Error '+ ErrsMess);
ErrsMess := '';
end;
procedure TDebugStringThread.Execute;
var SharedMem: Pointer;
SharedFile: THandle;
WaitingResult: DWORD;
DataReadyEvent: THandle;
BufferReadyEvent: THandle;
SecurityAttributes: SECURITY_ATTRIBUTES;
SecurityDescriptor: SECURITY_DESCRIPTOR;
SharedMemory : Pointer;
TempString : String;
begin
ErrsMess := '';
SecurityAttributes.nLength := SizeOf(SECURITY_ATTRIBUTES);
SecurityAttributes.bInheritHandle := True;
SecurityAttributes.lpSecurityDescriptor := @SecurityDescriptor;
if not InitializeSecurityDescriptor(@SecurityDescriptor, SECURITY_DESCRIPTOR_REVISION) then
Exit;
if not SetSecurityDescriptorDacl(@SecurityDescriptor, True, nil, False) then
Exit;
BufferReadyEvent := CreateEvent(@SecurityAttributes, False, True, 'DBWIN_BUFFER_READY');
if BufferReadyEvent = 0 then
Exit;
DataReadyEvent := CreateEvent(@SecurityAttributes, False, False, 'DBWIN_DATA_READY');
if DataReadyEvent = 0 then
Exit;
SharedFile := CreateFileMapping(THandle(-1), @SecurityAttributes, PAGE_READWRITE, 0, 4096, 'Global\DBWIN_BUFFER');
if SharedFile = 0 then
begin
ErrsMess := SysErrorMessage(GetLastError);
Synchronize(DoShowErrors);
Exit;
end;
SharedMem := MapViewOfFile(SharedFile, FILE_MAP_READ, 0, 0, 512);
SharedMemory := MapViewOfFile(SharedFile,SECTION_MAP_READ,0, 0, 1024);
if not Assigned(SharedMem) then
begin
ErrsMess := SysErrorMessage(GetLastError);
Synchronize(DoShowErrors);
Exit;
end;
if not Assigned(SharedMemory) then
begin
ErrsMess := SysErrorMessage(GetLastError);
Synchronize(DoShowErrors);
end;
while (not Terminated) and (not Application.Terminated) do
begin
SetEvent(BufferReadyEvent);
WaitingResult := WaitForSingleObject(DataReadyEvent, INFINITE);
case WaitingResult of
WAIT_TIMEOUT: Continue;
WAIT_OBJECT_0:
begin
try
TempString := '';
//CopyMemory(PChar(TempString),SharedMemory,sizeof(SharedMemory));// - returns 0....
TempString := String(PAnsiChar(SharedMemory)+ SizeOf(DWORD));
SharedMessage := TempString +' '+ String(PAnsiChar(SharedMem) + SizeOf(DWORD));
Synchronize(DoShowData);
finally
end;
end;
WAIT_FAILED: Continue;
end;
end;
UnmapViewOfFile(SharedMem);
CloseHandle(SharedFile);
end;
end.
[1]: http://stackoverflow.com/questions/6384785/how-can-i-receive-outputdebugstring-from-service
[2]: http://philondev.blogspot.ro/2009/12/monitoring-outputdebugstring-on-windows.html | 0 |
11,226,680 | 06/27/2012 12:54:22 | 510,036 | 11/16/2010 20:49:51 | 793 | 33 | Difference between char[] and new char[] when using constant lengths | So this may seem like a widely-answered question, but I'm interested more in the internals of what exactly happens differently between the two.
**Other than the fact that the second example creates not only the memory, but a pointer to the memory**, what happens *in memory* when the following happens:
char a[5];
char b* = new char[5];
And more directly related to *why* I asked this question, how come I can do
const int len = 5;
char* c = new char[len];
but not
const int len = 5;
char d[len]; // Compiler error
| c++ | memory | initialization | char-array | dynamic-allocation | null | open | Difference between char[] and new char[] when using constant lengths
===
So this may seem like a widely-answered question, but I'm interested more in the internals of what exactly happens differently between the two.
**Other than the fact that the second example creates not only the memory, but a pointer to the memory**, what happens *in memory* when the following happens:
char a[5];
char b* = new char[5];
And more directly related to *why* I asked this question, how come I can do
const int len = 5;
char* c = new char[len];
but not
const int len = 5;
char d[len]; // Compiler error
| 0 |
11,349,506 | 07/05/2012 17:32:44 | 1,442,364 | 06/07/2012 13:40:34 | 1 | 0 | Multiple Viewport OpenGL ES | I am currently trying to make an ios app that uses multiple opengl es viewports (i.e. a split screen). Here's how I'm doing it:
// Create default framebuffer object. The backing will be allocated for the current layer in -resizeFromLayer
glGenFramebuffersOES(1, &defaultFramebuffer);
glGenRenderbuffersOES(1, &colorRenderbuffer);
glBindFramebufferOES(GL_FRAMEBUFFER_OES, defaultFramebuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, colorRenderbuffer);
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, colorRenderbuffer);
// Replace the implementation of this method to do your own custom drawing
const GLfloat squareVertices[] = {
-0.5f, -0.5f,
0.5f, -0.5f,
-0.5f, 0.5f,
0.5f, 0.5f,
};
const GLubyte squareColors[] = {
255, 255, 0, 255,
0, 255, 255, 255,
0, 0, 0, 0,
255, 0, 255, 255,
};
[EAGLContext setCurrentContext:context];
glBindFramebufferOES(GL_FRAMEBUFFER_OES, defaultFramebuffer);
glViewport(0, backingHeight/2, backingWidth/2, backingHeight/2);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthof(-1.0f, 1.0f, -1.5f, 1.5f, -1.0f, 1.0f);
glMatrixMode(GL_MODELVIEW);
glRotatef(3.0f, 0.0f, 0.0f, 1.0f);
glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glVertexPointer(2, GL_FLOAT, 0, squareVertices);
glEnableClientState(GL_VERTEX_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, squareColors);
glEnableClientState(GL_COLOR_ARRAY);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, colorRenderbuffer);
// equivalent to glutswapBuffers()
[context presentRenderbuffer:GL_RENDERBUFFER_OES];
/*********************SECOND VIEW*******/
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_FRAMEBUFFER);
glBindFramebufferOES(GL_FRAMEBUFFER_OES, defaultFramebuffer);
glViewport(backingWidth/2, 0, backingWidth/2, backingHeight/2);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthof(-1.0f, 1.0f, -1.5f, 1.5f, -1.0f, 1.0f);
glMatrixMode(GL_MODELVIEW);
glRotatef(3.0f, 0.0f, 0.0f, 1.0f);
glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glVertexPointer(2, GL_FLOAT, 0, squareVertices);
glEnableClientState(GL_VERTEX_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, squareColors);
glEnableClientState(GL_COLOR_ARRAY);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, colorRenderbuffer);
[context presentRenderbuffer:GL_RENDERBUFFER_OES];
/*********************END***************/
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
1. On the simulator, only the second viewport appears (in this case a rotating cube in the bottom right corner of screen). Whereas on the device they both appear but blinking... (top left AND bottom riht)
2. the glRotatef gets applied twice, but I only want to or any other transformation to be applied once.
What i want is simply to show the same scene twice. Basically I'm trying to simulate having 2 cameras watching the same thing, and show this on the screen. Clearly, I'm doing something wrong, would it be better to have 2 separate framebuffers and renderbuffers or is there a simpler way of achieving this? | ios | opengl-es | viewport | null | null | null | open | Multiple Viewport OpenGL ES
===
I am currently trying to make an ios app that uses multiple opengl es viewports (i.e. a split screen). Here's how I'm doing it:
// Create default framebuffer object. The backing will be allocated for the current layer in -resizeFromLayer
glGenFramebuffersOES(1, &defaultFramebuffer);
glGenRenderbuffersOES(1, &colorRenderbuffer);
glBindFramebufferOES(GL_FRAMEBUFFER_OES, defaultFramebuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, colorRenderbuffer);
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, colorRenderbuffer);
// Replace the implementation of this method to do your own custom drawing
const GLfloat squareVertices[] = {
-0.5f, -0.5f,
0.5f, -0.5f,
-0.5f, 0.5f,
0.5f, 0.5f,
};
const GLubyte squareColors[] = {
255, 255, 0, 255,
0, 255, 255, 255,
0, 0, 0, 0,
255, 0, 255, 255,
};
[EAGLContext setCurrentContext:context];
glBindFramebufferOES(GL_FRAMEBUFFER_OES, defaultFramebuffer);
glViewport(0, backingHeight/2, backingWidth/2, backingHeight/2);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthof(-1.0f, 1.0f, -1.5f, 1.5f, -1.0f, 1.0f);
glMatrixMode(GL_MODELVIEW);
glRotatef(3.0f, 0.0f, 0.0f, 1.0f);
glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glVertexPointer(2, GL_FLOAT, 0, squareVertices);
glEnableClientState(GL_VERTEX_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, squareColors);
glEnableClientState(GL_COLOR_ARRAY);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, colorRenderbuffer);
// equivalent to glutswapBuffers()
[context presentRenderbuffer:GL_RENDERBUFFER_OES];
/*********************SECOND VIEW*******/
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_FRAMEBUFFER);
glBindFramebufferOES(GL_FRAMEBUFFER_OES, defaultFramebuffer);
glViewport(backingWidth/2, 0, backingWidth/2, backingHeight/2);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthof(-1.0f, 1.0f, -1.5f, 1.5f, -1.0f, 1.0f);
glMatrixMode(GL_MODELVIEW);
glRotatef(3.0f, 0.0f, 0.0f, 1.0f);
glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glVertexPointer(2, GL_FLOAT, 0, squareVertices);
glEnableClientState(GL_VERTEX_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, squareColors);
glEnableClientState(GL_COLOR_ARRAY);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, colorRenderbuffer);
[context presentRenderbuffer:GL_RENDERBUFFER_OES];
/*********************END***************/
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
1. On the simulator, only the second viewport appears (in this case a rotating cube in the bottom right corner of screen). Whereas on the device they both appear but blinking... (top left AND bottom riht)
2. the glRotatef gets applied twice, but I only want to or any other transformation to be applied once.
What i want is simply to show the same scene twice. Basically I'm trying to simulate having 2 cameras watching the same thing, and show this on the screen. Clearly, I'm doing something wrong, would it be better to have 2 separate framebuffers and renderbuffers or is there a simpler way of achieving this? | 0 |
11,349,507 | 07/05/2012 17:32:47 | 279,516 | 11/06/2009 20:59:46 | 2,369 | 73 | Collection properties should be read only - Loophole? | In the process of adhering to code analysis errors, I'm changing my properties to have private setters. Then I started trying to understand *why* a bit more. From some research, MS says [this][1]:
> A writable collection property allows a user to replace the collection with a completely different collection.
And the answer, [here][2], states:
> Adding a public setter on a `List<T>` object is dangerous.
But the *reason* why it's dangerous is not listed. And that's the part where I'm curious.
If we have this collection:
public List<Foo> Foos { get; set; }
Why make the setter private? Apparently we don't want client code to *replace* the collection, **but if a client can remove every element, and then add whatever they want, what's the point**? Is that not the same as replacing the collection entirely? How is value provided by following this code analysis rule?
[1]: http://msdn.microsoft.com/en-us/library/ms182327.aspx
[2]: http://stackoverflow.com/questions/5554566/c-sharp-code-analysis-2227-confusion | c# | oop | design | code-analysis | null | null | open | Collection properties should be read only - Loophole?
===
In the process of adhering to code analysis errors, I'm changing my properties to have private setters. Then I started trying to understand *why* a bit more. From some research, MS says [this][1]:
> A writable collection property allows a user to replace the collection with a completely different collection.
And the answer, [here][2], states:
> Adding a public setter on a `List<T>` object is dangerous.
But the *reason* why it's dangerous is not listed. And that's the part where I'm curious.
If we have this collection:
public List<Foo> Foos { get; set; }
Why make the setter private? Apparently we don't want client code to *replace* the collection, **but if a client can remove every element, and then add whatever they want, what's the point**? Is that not the same as replacing the collection entirely? How is value provided by following this code analysis rule?
[1]: http://msdn.microsoft.com/en-us/library/ms182327.aspx
[2]: http://stackoverflow.com/questions/5554566/c-sharp-code-analysis-2227-confusion | 0 |
11,349,508 | 07/05/2012 17:32:52 | 220,918 | 11/29/2009 17:43:52 | 485 | 11 | Rails Simpleform with non-model inputs | I have a normal form using simpleform. Now I'd like to add an input that does not have any corresponding field in the model, it will be processed by the controller. I tried
<%= simple_form_for @obj do |f| %>
<%= f.input :name %>
<%= f.input :attr, as: :string %> <-- should just send "attr" as post data
<% end %>
but this gives a `Method not found: attr_not_in_obj` error. I could obviously use the standard rails helpers, but then I will miss all of the simpleform HTML around the input, and copying doesn't quite seem right.
How do I add inputs that do not correspond to model attributes? | ruby-on-rails | ruby | forms | simple-form | null | null | open | Rails Simpleform with non-model inputs
===
I have a normal form using simpleform. Now I'd like to add an input that does not have any corresponding field in the model, it will be processed by the controller. I tried
<%= simple_form_for @obj do |f| %>
<%= f.input :name %>
<%= f.input :attr, as: :string %> <-- should just send "attr" as post data
<% end %>
but this gives a `Method not found: attr_not_in_obj` error. I could obviously use the standard rails helpers, but then I will miss all of the simpleform HTML around the input, and copying doesn't quite seem right.
How do I add inputs that do not correspond to model attributes? | 0 |
11,349,511 | 07/05/2012 17:33:06 | 322,518 | 04/21/2010 16:56:28 | 1,875 | 64 | What negative effect will happen when multiple threads write to the same file? | The following is pseudo code of an integration test that is failing:
[Test]
void TestLogger()
// Init static logger
Logger.Init(pathToFile);
// Create five threads that will call LogMessages delegate
for i = 1 to 5
{
Thread aThread = new Thread(LogMessages)
aThread.Start(i);
}
// let threads complete their work
Thread.Sleep(30000);
/// read from log file and count the lines
int lineCount = GetLineCount();
// 5 threads, each logs 5 times = 25 lines in the log
Assert.Equal(25, lineCount);
static void LogMessages( object data )
// each thread will log five messages
for i = 1 to 5
Logger.LogMessage(i.ToString() + " " + DateTime.Now.Ticks.ToString());
Thread.Sleep(50);
The number of lines seem to change each time the test is run. Sometimes the number of lines is 23 and sometimes 25.
After I dug through the code a little bit, I noticed that the log file is getting accessed at the same time by multiple threads (verified by tick count being the same). There is no lock around the access to this file, but at the same time I see no exceptions being thrown. Can anyone explain why the log line count between runs is inconsistent? Furthermore, is this a negative effect of writing to the same file by multiple threads at the same time? | c# | .net | multithreading | .net-2.0 | integration-testing | null | open | What negative effect will happen when multiple threads write to the same file?
===
The following is pseudo code of an integration test that is failing:
[Test]
void TestLogger()
// Init static logger
Logger.Init(pathToFile);
// Create five threads that will call LogMessages delegate
for i = 1 to 5
{
Thread aThread = new Thread(LogMessages)
aThread.Start(i);
}
// let threads complete their work
Thread.Sleep(30000);
/// read from log file and count the lines
int lineCount = GetLineCount();
// 5 threads, each logs 5 times = 25 lines in the log
Assert.Equal(25, lineCount);
static void LogMessages( object data )
// each thread will log five messages
for i = 1 to 5
Logger.LogMessage(i.ToString() + " " + DateTime.Now.Ticks.ToString());
Thread.Sleep(50);
The number of lines seem to change each time the test is run. Sometimes the number of lines is 23 and sometimes 25.
After I dug through the code a little bit, I noticed that the log file is getting accessed at the same time by multiple threads (verified by tick count being the same). There is no lock around the access to this file, but at the same time I see no exceptions being thrown. Can anyone explain why the log line count between runs is inconsistent? Furthermore, is this a negative effect of writing to the same file by multiple threads at the same time? | 0 |
11,349,513 | 07/05/2012 17:33:17 | 784,756 | 06/05/2011 13:23:59 | 168 | 2 | How can I implement TinyMCE with Require.js? | I am currently passing in the TinyMCE source as a dependency, and then calling
tinyMCE.init({}); but it is not initializing TinyMCE. When I console.log TinyMCE, it returns a TinyMCE Object. Code sample below:
define([
'jQuery',
'Underscore',
'Backbone',
'TinyMCE'
], function($, _, Backbone, tinyMCE) {
tinyMCE.init({
mode: "exact",
elements: $('textarea'),
theme: "advanced",
skin: 'skillshare',
theme_advanced_toolbar_location: 'top',
theme_advanced_buttons1: 'bold,italic,underline,bullist,numlist,link,unlink',
theme_advanced_buttons2: '',
theme_advanced_buttons3: '',
theme_advanced_toolbar_align: 'left',
plugins: 'paste,inlinepopups',
width: '100%',
height: textarea.attr('data-height'),
oninit: function () {
console.log('TargetTD :');
console.log(targetTD);
var targetTD = textarea.next().find('.mceIframeContainer');
var tinymce = textarea.next().find('iframe').contents().find('#tinymce');
tinymce.unbind('focus').bind('focus', function () {
targetTD.css({'background-color': '#fffff9'});
});
tinymce.unbind('blur').bind('blur', function () {
targetTD.css({'background-color': '#ffffff'});
});
}
});
}
});
| javascript | jquery | tinymce | requirejs | null | null | open | How can I implement TinyMCE with Require.js?
===
I am currently passing in the TinyMCE source as a dependency, and then calling
tinyMCE.init({}); but it is not initializing TinyMCE. When I console.log TinyMCE, it returns a TinyMCE Object. Code sample below:
define([
'jQuery',
'Underscore',
'Backbone',
'TinyMCE'
], function($, _, Backbone, tinyMCE) {
tinyMCE.init({
mode: "exact",
elements: $('textarea'),
theme: "advanced",
skin: 'skillshare',
theme_advanced_toolbar_location: 'top',
theme_advanced_buttons1: 'bold,italic,underline,bullist,numlist,link,unlink',
theme_advanced_buttons2: '',
theme_advanced_buttons3: '',
theme_advanced_toolbar_align: 'left',
plugins: 'paste,inlinepopups',
width: '100%',
height: textarea.attr('data-height'),
oninit: function () {
console.log('TargetTD :');
console.log(targetTD);
var targetTD = textarea.next().find('.mceIframeContainer');
var tinymce = textarea.next().find('iframe').contents().find('#tinymce');
tinymce.unbind('focus').bind('focus', function () {
targetTD.css({'background-color': '#fffff9'});
});
tinymce.unbind('blur').bind('blur', function () {
targetTD.css({'background-color': '#ffffff'});
});
}
});
}
});
| 0 |
11,349,489 | 07/05/2012 17:31:43 | 1,504,739 | 07/05/2012 17:16:21 | 1 | 0 | group developing | We have a team of 4 **asp.net** developers. we are developing a web application. but we don't have exprience in group developing.
So the first question is that can you suggest some tips for group working?
And the second one:We decided to use three layer architecture pattern. but we don't know whether to develop each layer completly and then start to develop another layer? or for eact functional requirement develop all of the layers together? | asp.net | architecture | null | null | null | 07/06/2012 18:07:52 | off topic | group developing
===
We have a team of 4 **asp.net** developers. we are developing a web application. but we don't have exprience in group developing.
So the first question is that can you suggest some tips for group working?
And the second one:We decided to use three layer architecture pattern. but we don't know whether to develop each layer completly and then start to develop another layer? or for eact functional requirement develop all of the layers together? | 2 |
11,349,490 | 07/05/2012 17:31:49 | 1,504,758 | 07/05/2012 17:28:49 | 1 | 0 | How to stop loading data to reportviewer on page_load | do you somebody know how to stop loading data to reportviewer when page_load?
I have filters on Index.aspx and reportviewer, but i want to load data only by clicking on refresh button after the filter is specified, because there are a lot of data in the database and after page load the data is retrivieng from database so long!
Thank you for your help.
Peter | c# | asp.net | report | reportviewer | null | null | open | How to stop loading data to reportviewer on page_load
===
do you somebody know how to stop loading data to reportviewer when page_load?
I have filters on Index.aspx and reportviewer, but i want to load data only by clicking on refresh button after the filter is specified, because there are a lot of data in the database and after page load the data is retrivieng from database so long!
Thank you for your help.
Peter | 0 |
11,349,491 | 07/05/2012 17:31:56 | 1,389,807 | 05/11/2012 15:37:06 | 15 | 0 | PHPExcel Header Line covering first entry | Okay, next PHPExcel question. I have an HTML form that users fill out and the data will be sent to a database. All this works with no problems. I am using PHPExcel to send that information to an Excel worksheet so the President of the organization can view reports that have been sent in (he chose that he wanted it in Excel). When he clicks the button, the information is downloaded to Excel. This all works fine, except for the first line of the worksheet is covered by the Header information. I know that it is the header, because if I change $headings and delete value(s) in the array, part(s) of the hidden query then shows.
I got this code from: http://phpexcel.codeplex.com/discussions/246121/
There may be a coding error, or I may not have uploaded all the files and classes to the internet...
Any help is appreciated. Thanks.
// connection with the database
$dbhost = "I removed this for privacy";
$dbuser = "I removed this for privacy";
$dbpass = "I removed this for privacy";
$dbname = "I removed this for privacy";
mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname);
// require the PHPExcel file
require 'Classes/PHPExcel.php';
// simple query
$query = "
SELECT dueDate, reporterName, program, noReportReason, recentActivity, impacted, fundsGenerated, fundsSpent, volunteers, input, potentialContacts, potentialSources
FROM reports
ORDER BY id
";
if ($result = mysql_query($query) or die(mysql_error()))
{
// Create a new PHPExcel object
$objPHPExcel = new PHPExcel();
$objPHPExcel->getActiveSheet()->setTitle('Quarterly Project Reports');
// Loop through the result set
$rowNumber = 1;
while ($row = mysql_fetch_row($result))
{
$col = 'A';
foreach($row as $cell)
{
$objPHPExcel->getActiveSheet()->setCellValue($col.$rowNumber,$cell);
$col++;
}
$rowNumber++;
}
$rowNumber = 1;
$headings = array('Due Date','Reporter Name','Name of Program','No Report This Quarter',
'Recent Activity','Number of People Impacted','Funds Generated',
'Funds Spent and Fuding Sources','Volunteers Mobilized','WNP Input',
'Potential Contacts','Potential Sources');
$objPHPExcel->getActiveSheet()->fromArray(array($headings),NULL,'A'.$rowNumber);
$rowNumber++;
// Loop through the result set
while ($row = mysql_fetch_row($result))
{
$col = 'A';
foreach($row as $cell)
{
$objPHPExcel->getActiveSheet()->setCellValue($col.$rowNumber,$cell);
$col++;
}
$rowNumber++;
}
//bold Header row
$objPHPExcel->getActiveSheet()->getStyle('A1:L1')->getFont()->setBold(true);
//wrap column D
$objPHPExcel->getActiveSheet()->getStyle('D1:D'.$objPHPExcel->getActiveSheet()->getHighestRow())->getAlignment()->setWrapText(true);
//wrap column E
$objPHPExcel->getActiveSheet()->getStyle('E1:E'.$objPHPExcel->getActiveSheet()->getHighestRow())->getAlignment()->setWrapText(true);
//set header row height
$objPHPExcel->getActiveSheet()->getRowDimension('1')->setRowHeight(20);
//set column widths
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(15);
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(50);
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(50);
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension('J')->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension('K')->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension('L')->setWidth(30);
// Save as an Excel BIFF (xls) file
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="WNPQuarterlyReports.xls"');
$objWriter->save('php://output');
exit();
}
echo 'a problem has occurred... no data retrieved from the database'; | php | mysql | database | excel | phpexcel | null | open | PHPExcel Header Line covering first entry
===
Okay, next PHPExcel question. I have an HTML form that users fill out and the data will be sent to a database. All this works with no problems. I am using PHPExcel to send that information to an Excel worksheet so the President of the organization can view reports that have been sent in (he chose that he wanted it in Excel). When he clicks the button, the information is downloaded to Excel. This all works fine, except for the first line of the worksheet is covered by the Header information. I know that it is the header, because if I change $headings and delete value(s) in the array, part(s) of the hidden query then shows.
I got this code from: http://phpexcel.codeplex.com/discussions/246121/
There may be a coding error, or I may not have uploaded all the files and classes to the internet...
Any help is appreciated. Thanks.
// connection with the database
$dbhost = "I removed this for privacy";
$dbuser = "I removed this for privacy";
$dbpass = "I removed this for privacy";
$dbname = "I removed this for privacy";
mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname);
// require the PHPExcel file
require 'Classes/PHPExcel.php';
// simple query
$query = "
SELECT dueDate, reporterName, program, noReportReason, recentActivity, impacted, fundsGenerated, fundsSpent, volunteers, input, potentialContacts, potentialSources
FROM reports
ORDER BY id
";
if ($result = mysql_query($query) or die(mysql_error()))
{
// Create a new PHPExcel object
$objPHPExcel = new PHPExcel();
$objPHPExcel->getActiveSheet()->setTitle('Quarterly Project Reports');
// Loop through the result set
$rowNumber = 1;
while ($row = mysql_fetch_row($result))
{
$col = 'A';
foreach($row as $cell)
{
$objPHPExcel->getActiveSheet()->setCellValue($col.$rowNumber,$cell);
$col++;
}
$rowNumber++;
}
$rowNumber = 1;
$headings = array('Due Date','Reporter Name','Name of Program','No Report This Quarter',
'Recent Activity','Number of People Impacted','Funds Generated',
'Funds Spent and Fuding Sources','Volunteers Mobilized','WNP Input',
'Potential Contacts','Potential Sources');
$objPHPExcel->getActiveSheet()->fromArray(array($headings),NULL,'A'.$rowNumber);
$rowNumber++;
// Loop through the result set
while ($row = mysql_fetch_row($result))
{
$col = 'A';
foreach($row as $cell)
{
$objPHPExcel->getActiveSheet()->setCellValue($col.$rowNumber,$cell);
$col++;
}
$rowNumber++;
}
//bold Header row
$objPHPExcel->getActiveSheet()->getStyle('A1:L1')->getFont()->setBold(true);
//wrap column D
$objPHPExcel->getActiveSheet()->getStyle('D1:D'.$objPHPExcel->getActiveSheet()->getHighestRow())->getAlignment()->setWrapText(true);
//wrap column E
$objPHPExcel->getActiveSheet()->getStyle('E1:E'.$objPHPExcel->getActiveSheet()->getHighestRow())->getAlignment()->setWrapText(true);
//set header row height
$objPHPExcel->getActiveSheet()->getRowDimension('1')->setRowHeight(20);
//set column widths
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(15);
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(50);
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(50);
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension('J')->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension('K')->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension('L')->setWidth(30);
// Save as an Excel BIFF (xls) file
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="WNPQuarterlyReports.xls"');
$objWriter->save('php://output');
exit();
}
echo 'a problem has occurred... no data retrieved from the database'; | 0 |
11,349,519 | 07/05/2012 17:33:36 | 401,643 | 07/25/2010 16:56:58 | 1,069 | 4 | Move Data Access logic from the business layer to the data access layer | I am doing an asp.net mvc application having a Data Access Layer (DAL).
Having done 90% of my database CRUD code I asked myself wether I need a Business Layer.
But what should I put there? All my CRUD methods in the DAL are not single Selects on one sql table for example. Most time I do many joins + sql aggregate functions. Just to mention I use ADO.NET , NO Stored Procedures/Triggers.
Then again I asked myself wether such a method would belong in a Business Layer:
/// <summary>
/// Creates a testplan with all teststeps and their default values for a certain template
/// </summary>
/// <param name="testplan"></param>
/// <returns>true if transaction was successfull else false</returns>
public void CreateTestplan(Testplan testplan)
{
try
{
using (var con = new SqlConnection(_connectionString))
using (var trans = new TransactionScope())
{
con.Open();
_testplanDataProvider.AddTestplan(testplan,con);
_testplanDataProvider.CreateTeststepsForTestplan(testplan.Id, testplan.TemplateId,con);
trans.Complete();
}
}
catch (SqlException ex)
{
ExceptionManager.HandleException(ex);
}
}
This method is actually calling TWO other methods in the DAL.
Now I asked myself, why introduce an extra Business Layer, when I can put the CreateTestplan method also inside the TestplanDataProvider class with all the code from both methods AddTestplan + CreateTeststepsForTestplan.
What do you think? Is this a good approach?
I really ask this because the CreateTestplan method is only containing Data Access Logic in my opinion.
| c# | data-access-layer | business-logic | service-layer | bll | null | open | Move Data Access logic from the business layer to the data access layer
===
I am doing an asp.net mvc application having a Data Access Layer (DAL).
Having done 90% of my database CRUD code I asked myself wether I need a Business Layer.
But what should I put there? All my CRUD methods in the DAL are not single Selects on one sql table for example. Most time I do many joins + sql aggregate functions. Just to mention I use ADO.NET , NO Stored Procedures/Triggers.
Then again I asked myself wether such a method would belong in a Business Layer:
/// <summary>
/// Creates a testplan with all teststeps and their default values for a certain template
/// </summary>
/// <param name="testplan"></param>
/// <returns>true if transaction was successfull else false</returns>
public void CreateTestplan(Testplan testplan)
{
try
{
using (var con = new SqlConnection(_connectionString))
using (var trans = new TransactionScope())
{
con.Open();
_testplanDataProvider.AddTestplan(testplan,con);
_testplanDataProvider.CreateTeststepsForTestplan(testplan.Id, testplan.TemplateId,con);
trans.Complete();
}
}
catch (SqlException ex)
{
ExceptionManager.HandleException(ex);
}
}
This method is actually calling TWO other methods in the DAL.
Now I asked myself, why introduce an extra Business Layer, when I can put the CreateTestplan method also inside the TestplanDataProvider class with all the code from both methods AddTestplan + CreateTeststepsForTestplan.
What do you think? Is this a good approach?
I really ask this because the CreateTestplan method is only containing Data Access Logic in my opinion.
| 0 |
11,349,520 | 07/05/2012 17:33:40 | 482,285 | 10/20/2010 21:10:52 | 18 | 2 | Scala: How to treat an Any like an Array or Seq? | I'm looking for a way to treat an Any as an Array or Seq and iterate over it, if possible.
Currently I have some code that looks like this, taking a sequence of Any's and flattening out any Traversable or Array objects contained.
def flattenAsStrings(as: Seq[Any]): Seq[String] = {
val (travValued, other) = as.partition(a => classOf[Traversable[_]] isAssignableFrom(a.getClass))
val (arrayValued, singleValued) = other.partition(a => a.isInstanceOf[Array[_]])
val travStrings = travValued.map(_.asInstanceOf[Traversable[_]].map(_.toString)).flatMap(_.toList)
val arrayStrings = arrayValued.map(_.asInstanceOf[Array[_]].map(_.toString)).flatMap(_.toList)
singleValued.map(_.toString) ++ travStrings ++ arrayStrings
}
It feels like there mustr be a simpler way to do this in Scala, given implicit conversions and whatnot. Anyone? | scala | null | null | null | null | null | open | Scala: How to treat an Any like an Array or Seq?
===
I'm looking for a way to treat an Any as an Array or Seq and iterate over it, if possible.
Currently I have some code that looks like this, taking a sequence of Any's and flattening out any Traversable or Array objects contained.
def flattenAsStrings(as: Seq[Any]): Seq[String] = {
val (travValued, other) = as.partition(a => classOf[Traversable[_]] isAssignableFrom(a.getClass))
val (arrayValued, singleValued) = other.partition(a => a.isInstanceOf[Array[_]])
val travStrings = travValued.map(_.asInstanceOf[Traversable[_]].map(_.toString)).flatMap(_.toList)
val arrayStrings = arrayValued.map(_.asInstanceOf[Array[_]].map(_.toString)).flatMap(_.toList)
singleValued.map(_.toString) ++ travStrings ++ arrayStrings
}
It feels like there mustr be a simpler way to do this in Scala, given implicit conversions and whatnot. Anyone? | 0 |
11,349,521 | 07/05/2012 17:33:44 | 923,406 | 09/01/2011 12:00:57 | 47 | 2 | Django {% url %} supported in AppEngine Launcher? | With latest AppEngine is Django 1.3.
Should the Django tag {% url %} work in Lanucher when app run locally? | django | google-app-engine | null | null | null | null | open | Django {% url %} supported in AppEngine Launcher?
===
With latest AppEngine is Django 1.3.
Should the Django tag {% url %} work in Lanucher when app run locally? | 0 |
11,347,573 | 07/05/2012 15:27:07 | 574,301 | 01/13/2011 13:42:04 | 13 | 1 | Read dynamic PDF from Ruby Watir | I am using Watir to log into an application, push some buttons, etc... Basically the normal stuff that a person would use Watir for.
However, my problem is that there is one particular page that I need to test. It's actually a dynamically-generated PDF and I need to get the actual binary data from it, so that I can load it using a certain gem that we're using. This normally works with static PDF files because we can just use:
open("http://site.com/something.pdf")
This works for static PDFs. However, for a dynamically generated one it doesn't work because we are using Ruby to send the HTTP request and it is not aware of the headers/cookies/session that Watir is using. So instead of getting the actual PDF we get a login page.
Another thing we tried was to use Watir to get the PDF:
@browser.goto "http://site.com/dynamic/thepdffile"
@browser.text
@browser.html
We tried getting the text or html from the page, but no luck because firefox creates a DOM when loading a pdf so the text is an empty string and the html is the DOM that firefox creates when viewing a pdf page. We need the raw HTTP response and there doesn't seem to be a way to extract that.
So we need a solution for this and in my opinion we have these options:
1. Figure out a way to use "open" or similar method in Ruby, using the session from Watir.
2. Figure out how to use watir to get the binary http response from the PDF page.
3. Disable the pdf plugin (which doesn't seem possible) such that the "save as" dialog appears.
Or if you have some other idea please share! Thanks in advance! | ruby | pdf | watir | null | null | null | open | Read dynamic PDF from Ruby Watir
===
I am using Watir to log into an application, push some buttons, etc... Basically the normal stuff that a person would use Watir for.
However, my problem is that there is one particular page that I need to test. It's actually a dynamically-generated PDF and I need to get the actual binary data from it, so that I can load it using a certain gem that we're using. This normally works with static PDF files because we can just use:
open("http://site.com/something.pdf")
This works for static PDFs. However, for a dynamically generated one it doesn't work because we are using Ruby to send the HTTP request and it is not aware of the headers/cookies/session that Watir is using. So instead of getting the actual PDF we get a login page.
Another thing we tried was to use Watir to get the PDF:
@browser.goto "http://site.com/dynamic/thepdffile"
@browser.text
@browser.html
We tried getting the text or html from the page, but no luck because firefox creates a DOM when loading a pdf so the text is an empty string and the html is the DOM that firefox creates when viewing a pdf page. We need the raw HTTP response and there doesn't seem to be a way to extract that.
So we need a solution for this and in my opinion we have these options:
1. Figure out a way to use "open" or similar method in Ruby, using the session from Watir.
2. Figure out how to use watir to get the binary http response from the PDF page.
3. Disable the pdf plugin (which doesn't seem possible) such that the "save as" dialog appears.
Or if you have some other idea please share! Thanks in advance! | 0 |
11,541,467 | 07/18/2012 12:33:48 | 1,511,429 | 07/09/2012 08:35:56 | 8 | 0 | horizantal menu with horizontal submenu | i am trying to make an horizontal menu with horizontal submenu i've tried something but it didn't work : the code above was supposed to display the horizontal main menu , when you hover on one of the links the color of the link changes and an horizontal submenu appears
html code:
<div id="menu">
<ul>
<li style="float: left; a:hover; "><a href="acceuil.html" style="color : #CBCAC7 ;">ACCEUIL</a> <img src="decoupage/puce_menu.png" height="15"/>
<ul>
<li style="float: left; display: none; "><a href="#">Présentation</a> </li>
</ul>
</li>
<li style="float: left; "><a href="methodologie.html" style="color : #CBCAC7 ;" >METHODOLOGIE</a></li> <img src="decoupage/puce_menu.png" height="15"/>
<li style="float: left; "><a href="references.html" style="color : #CBCAC7 ;">REFERENCES</a> <img src="decoupage/puce_menu.png" height="15"/>
<ul>
<li style="float: left; display: none; "><a href="#">Urbanisme</a></li>
<li style="float: left; display: none; "><a href="#">Tours</a></li>
<li style="float: left; display: none; "><a href="#">Bureau</a></li>
<li style="float: left; display: none; "><a href="#">Commerce</a></li>
<li style="float: left; display: none; "><a href="#">Logements</a></li>
</ul>
</li>
<li style="float: left; "><a href="partenaires.html" style="color : #CBCAC7 ;">PARTENAIRES</a></li> <img src="decoupage/puce_menu.png" height="15"/>
<li style="float: left; "><a href="contact.html" style="color : #CBCAC7 ;">CONTACT</a></li> <img src="decoupage/puce_menu.png" height="15"/>
</ul>
</div>
CSS code
#menu
{ position: absolute;
right: 550px;
bottom: 460px;
z-index: 2;
font-style: italic ;
font-size: large ;
}
#menu li.hover ul {
display: inline;}
| html | css | null | null | null | null | open | horizantal menu with horizontal submenu
===
i am trying to make an horizontal menu with horizontal submenu i've tried something but it didn't work : the code above was supposed to display the horizontal main menu , when you hover on one of the links the color of the link changes and an horizontal submenu appears
html code:
<div id="menu">
<ul>
<li style="float: left; a:hover; "><a href="acceuil.html" style="color : #CBCAC7 ;">ACCEUIL</a> <img src="decoupage/puce_menu.png" height="15"/>
<ul>
<li style="float: left; display: none; "><a href="#">Présentation</a> </li>
</ul>
</li>
<li style="float: left; "><a href="methodologie.html" style="color : #CBCAC7 ;" >METHODOLOGIE</a></li> <img src="decoupage/puce_menu.png" height="15"/>
<li style="float: left; "><a href="references.html" style="color : #CBCAC7 ;">REFERENCES</a> <img src="decoupage/puce_menu.png" height="15"/>
<ul>
<li style="float: left; display: none; "><a href="#">Urbanisme</a></li>
<li style="float: left; display: none; "><a href="#">Tours</a></li>
<li style="float: left; display: none; "><a href="#">Bureau</a></li>
<li style="float: left; display: none; "><a href="#">Commerce</a></li>
<li style="float: left; display: none; "><a href="#">Logements</a></li>
</ul>
</li>
<li style="float: left; "><a href="partenaires.html" style="color : #CBCAC7 ;">PARTENAIRES</a></li> <img src="decoupage/puce_menu.png" height="15"/>
<li style="float: left; "><a href="contact.html" style="color : #CBCAC7 ;">CONTACT</a></li> <img src="decoupage/puce_menu.png" height="15"/>
</ul>
</div>
CSS code
#menu
{ position: absolute;
right: 550px;
bottom: 460px;
z-index: 2;
font-style: italic ;
font-size: large ;
}
#menu li.hover ul {
display: inline;}
| 0 |
11,541,468 | 07/18/2012 12:33:49 | 647,909 | 03/07/2011 09:50:16 | 545 | 8 | Activate script on click event | If I want to activate a piece of code on click I would put the code in the head like this:
<script type="text/javascript">
function myFeed() {
...code...
}
</script>
And then call it like this:
<button onclick="myFeed();"> click </button>
But now Im facing a problem using FeedBurner. All I have is this:
<script src="http://feeds.feedburner.com/nu/gbKB?format=sigpro" type="text/javascript" ></script>
How can I assign a function to it like I did in the first example and call it in the body?? | javascript | jquery | feedburner | null | null | null | open | Activate script on click event
===
If I want to activate a piece of code on click I would put the code in the head like this:
<script type="text/javascript">
function myFeed() {
...code...
}
</script>
And then call it like this:
<button onclick="myFeed();"> click </button>
But now Im facing a problem using FeedBurner. All I have is this:
<script src="http://feeds.feedburner.com/nu/gbKB?format=sigpro" type="text/javascript" ></script>
How can I assign a function to it like I did in the first example and call it in the body?? | 0 |
11,541,471 | 07/18/2012 12:34:01 | 1,237,288 | 02/28/2012 07:07:08 | 352 | 14 | Invoke php extensions and dll functionalities dynamically | Invoke php extensions which I made externally using php script...
Is there any way to achieve it..? | php | extension | null | null | null | null | open | Invoke php extensions and dll functionalities dynamically
===
Invoke php extensions which I made externally using php script...
Is there any way to achieve it..? | 0 |
11,541,300 | 07/18/2012 12:25:00 | 541,917 | 08/07/2010 06:02:10 | 468 | 34 | Consuming Microsoft Charts with Multiple Series | I am developing an application where in i will prompt the user to choose the x and y axis columns from the data table and then bind them to the chart control in asp.net mvc2.
However, this works fine for me with single series chart. In the case of a multiple series chart, we have more than 1 series. Since I have to get the input from the user, kindly suggest me whether i have to get the x and y axis columns for series2 along with the series type.
Will there be any use case of mixing up the series types in a single chart. Kindly suggest the best practice.
**EDIT**
I am getting the data in a datatable and then binding the data to the chart control as datasource | asp.net-mvc-2 | mschart | null | null | null | null | open | Consuming Microsoft Charts with Multiple Series
===
I am developing an application where in i will prompt the user to choose the x and y axis columns from the data table and then bind them to the chart control in asp.net mvc2.
However, this works fine for me with single series chart. In the case of a multiple series chart, we have more than 1 series. Since I have to get the input from the user, kindly suggest me whether i have to get the x and y axis columns for series2 along with the series type.
Will there be any use case of mixing up the series types in a single chart. Kindly suggest the best practice.
**EDIT**
I am getting the data in a datatable and then binding the data to the chart control as datasource | 0 |
11,541,489 | 07/18/2012 12:34:44 | 1,326,244 | 04/11/2012 09:49:03 | 6 | 0 | Incorrect Height on iPhone | A display issue has been reported on the iPhone. I do not have one. I was wondering if anyone had any ideas.
On my website. The trouble appears to be caused by the url bar. On android, the function `$(window).height()` returns (screen height - url bar). On iOS, it doesn't appear to be doing this.
On my site I am skipping the page down past the url bar. I am then making the images full screen and centered. ( I have to use Javascript because of some spec restrictions )
In Android, the images are resized to the visible area of the screen. On the iPhone they *appear* to be getting resized to the available height - url bar height (whether the url bar is there or not). This causes the images to be too small with a gap at the bottom. At least this is my understanding of the problem.
iPhone Screenshots.
http://i.imgur.com/IJNyD.png
http://i.imgur.com/0egwI.png
This is what I am using to resize the images.
window.scrollTo(0, 1);
function setImageSize() {
var windowWidth = $(window).width();
var windowHeight = $(window).height();
$('.photo-slide img').each(function() {
var width = $(this).attr('data-width');
var height = $(this).attr('data-height');
if (width > windowWidth) {
var ratio = windowWidth / width;
width = windowWidth;
height = height * ratio;
}
if (height > windowHeight) {
var ratio = windowHeight / height;
height = windowHeight;
width = width * ratio;
}
var marginTop = 0;
var marginLeft = 0;
if (windowHeight > height) {
marginTop = (windowHeight - height) / 2;
}
if (windowWidth > width) {
marginLeft = (windowWidth - width) / 2;
}
$(this).css({
'margin-left':marginLeft+'px',
'margin-top':marginTop+'px',
'width':width+'px',
'height':height+'px'
})
})
}
Has anyone come across this before? How do I fix this so the image fills the screen when the url bar is not visible. | iphone | fullscreen | null | null | null | null | open | Incorrect Height on iPhone
===
A display issue has been reported on the iPhone. I do not have one. I was wondering if anyone had any ideas.
On my website. The trouble appears to be caused by the url bar. On android, the function `$(window).height()` returns (screen height - url bar). On iOS, it doesn't appear to be doing this.
On my site I am skipping the page down past the url bar. I am then making the images full screen and centered. ( I have to use Javascript because of some spec restrictions )
In Android, the images are resized to the visible area of the screen. On the iPhone they *appear* to be getting resized to the available height - url bar height (whether the url bar is there or not). This causes the images to be too small with a gap at the bottom. At least this is my understanding of the problem.
iPhone Screenshots.
http://i.imgur.com/IJNyD.png
http://i.imgur.com/0egwI.png
This is what I am using to resize the images.
window.scrollTo(0, 1);
function setImageSize() {
var windowWidth = $(window).width();
var windowHeight = $(window).height();
$('.photo-slide img').each(function() {
var width = $(this).attr('data-width');
var height = $(this).attr('data-height');
if (width > windowWidth) {
var ratio = windowWidth / width;
width = windowWidth;
height = height * ratio;
}
if (height > windowHeight) {
var ratio = windowHeight / height;
height = windowHeight;
width = width * ratio;
}
var marginTop = 0;
var marginLeft = 0;
if (windowHeight > height) {
marginTop = (windowHeight - height) / 2;
}
if (windowWidth > width) {
marginLeft = (windowWidth - width) / 2;
}
$(this).css({
'margin-left':marginLeft+'px',
'margin-top':marginTop+'px',
'width':width+'px',
'height':height+'px'
})
})
}
Has anyone come across this before? How do I fix this so the image fills the screen when the url bar is not visible. | 0 |
11,713,336 | 07/29/2012 22:00:07 | 1,561,586 | 07/29/2012 21:51:51 | 1 | 0 | Add </LI> closing tags to each REGEX match in string | I have an HTML document with unclosed `<LI>` elements. I need to append `</LI>` to the end of each `</OBJECT>` that follows the opening `<LI>` tag.
**Note:** Objects that aren't preceded by `<LI>` should not have an `</LI>` tag appended to `</OBJECT>`
<OBJECT value="example">
<param name="Joe">
</OBJECT>
<UL>
<LI> <OBJECT type="example">
<param name="Pat">
<param name="State" value="Arizona">
</OBJECT>
<UL>
<LI> <OBJECT type="example">
<param name="Steve">
<param name="State" value="California">
</OBJECT>
<OBJECT type="text/sitemap">
<param name="Carol">
</OBJECT>
This is what I've got so far with no luck
private void closeListItems(string doc)
{
StringBuilder sb = new StringBuilder();
Regex rx = new Regex("(<LI>.(.+?)</OBJECT>)", RegexOptions.Multiline | RegexOptions.IgnoreCase);
string[] hhcFile = File.ReadAllLines(doc);
string temp = "";
foreach (string line in hhcFile)
{
temp += line + "\n";
}
temp = rx.Replace(temp, "<LI>");
StreamWriter sw = new StreamWriter(Application.StartupPath + "\\liFix.txt");
sw.Write(temp);
sw.Close();
} | c# | html | regex | string | null | null | open | Add </LI> closing tags to each REGEX match in string
===
I have an HTML document with unclosed `<LI>` elements. I need to append `</LI>` to the end of each `</OBJECT>` that follows the opening `<LI>` tag.
**Note:** Objects that aren't preceded by `<LI>` should not have an `</LI>` tag appended to `</OBJECT>`
<OBJECT value="example">
<param name="Joe">
</OBJECT>
<UL>
<LI> <OBJECT type="example">
<param name="Pat">
<param name="State" value="Arizona">
</OBJECT>
<UL>
<LI> <OBJECT type="example">
<param name="Steve">
<param name="State" value="California">
</OBJECT>
<OBJECT type="text/sitemap">
<param name="Carol">
</OBJECT>
This is what I've got so far with no luck
private void closeListItems(string doc)
{
StringBuilder sb = new StringBuilder();
Regex rx = new Regex("(<LI>.(.+?)</OBJECT>)", RegexOptions.Multiline | RegexOptions.IgnoreCase);
string[] hhcFile = File.ReadAllLines(doc);
string temp = "";
foreach (string line in hhcFile)
{
temp += line + "\n";
}
temp = rx.Replace(temp, "<LI>");
StreamWriter sw = new StreamWriter(Application.StartupPath + "\\liFix.txt");
sw.Write(temp);
sw.Close();
} | 0 |
11,713,337 | 07/29/2012 22:00:32 | 967,451 | 09/27/2011 15:54:34 | 1,152 | 19 | MySQL: How to use Stored Procedures to insert rows into different tables? | Currently when a new row is inserted into my `users` table I have 1 row inserted into each of these other tables respectively:
profiles
user_settings
user_activity
Currently I'm doing if from the PHP:
$query = mysql_query('INSERT INTO `users` blah blah...');
if($query) {
mysql_query('INSERT INTO `profiles` blah blah...');
mysql_query('INSERT INTO `user_settings` blah blah...');
mysql_query('INSERT INTO `user_activity` blah blah...');
}
How can this be done via stored procedures? So that this work will be done by the database server and not the PHP code. Also is there any benefits to doing this from stored procedures vs from code? | mysql | null | null | null | null | null | open | MySQL: How to use Stored Procedures to insert rows into different tables?
===
Currently when a new row is inserted into my `users` table I have 1 row inserted into each of these other tables respectively:
profiles
user_settings
user_activity
Currently I'm doing if from the PHP:
$query = mysql_query('INSERT INTO `users` blah blah...');
if($query) {
mysql_query('INSERT INTO `profiles` blah blah...');
mysql_query('INSERT INTO `user_settings` blah blah...');
mysql_query('INSERT INTO `user_activity` blah blah...');
}
How can this be done via stored procedures? So that this work will be done by the database server and not the PHP code. Also is there any benefits to doing this from stored procedures vs from code? | 0 |
11,713,496 | 07/29/2012 22:22:07 | 1,561,585 | 07/29/2012 21:51:49 | 1 | 0 | Setting attribute of Django model instance in clean() when model has generic foreign key fails | Here is a toy example to illustrate the problem:
# models.py
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.db import models
class MyRelatedModel(models.Model):
some_field = models.IntegerField()
some_models = generic.GenericRelation('MyModel')
class MyModel(models.Model):
data = models.TextField()
more_data = models.FloatField(editable=False)
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey()
def clean(self):
super(MyModel, self).clean()
self.more_data = 5.5
def save(self, *args, **options):
print self.more_data # prints 'None'
super(MyModel, self).save(*args, **options)
The following goes in admin.py:
from django.contrib import admin
from django.contrib.contenttypes import generic
from test_model_save.models import MyModel, MyRelatedModel
class MyModelInline(generic.GenericTabularInline):
model = MyModel
class MyRelatedModelAdmin(admin.ModelAdmin):
inlines = [MyModelInline]
admin.site.register(MyModel)
admin.site.register(MyRelatedModel, MyRelatedModelAdmin)
When I try to create an object in the Django admin, I get the following error:
IntegrityError at /admin/test_model_save/myrelatedmodel/add/
test_model_save_mymodel.more_data may not be NULL
Before adding the generic foreign key to MyModel, the line `self.more_data = 5.5` in `clean()` successfully set the attribute value. In the example above, however, the attribute value is not persisted until `save()`. I am at a loss what might be causing this behavior. Am I doing something wrong?
(Tested using Django 1.4 with Sqlite backend) | django | django-models | django-admin | null | null | null | open | Setting attribute of Django model instance in clean() when model has generic foreign key fails
===
Here is a toy example to illustrate the problem:
# models.py
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.db import models
class MyRelatedModel(models.Model):
some_field = models.IntegerField()
some_models = generic.GenericRelation('MyModel')
class MyModel(models.Model):
data = models.TextField()
more_data = models.FloatField(editable=False)
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey()
def clean(self):
super(MyModel, self).clean()
self.more_data = 5.5
def save(self, *args, **options):
print self.more_data # prints 'None'
super(MyModel, self).save(*args, **options)
The following goes in admin.py:
from django.contrib import admin
from django.contrib.contenttypes import generic
from test_model_save.models import MyModel, MyRelatedModel
class MyModelInline(generic.GenericTabularInline):
model = MyModel
class MyRelatedModelAdmin(admin.ModelAdmin):
inlines = [MyModelInline]
admin.site.register(MyModel)
admin.site.register(MyRelatedModel, MyRelatedModelAdmin)
When I try to create an object in the Django admin, I get the following error:
IntegrityError at /admin/test_model_save/myrelatedmodel/add/
test_model_save_mymodel.more_data may not be NULL
Before adding the generic foreign key to MyModel, the line `self.more_data = 5.5` in `clean()` successfully set the attribute value. In the example above, however, the attribute value is not persisted until `save()`. I am at a loss what might be causing this behavior. Am I doing something wrong?
(Tested using Django 1.4 with Sqlite backend) | 0 |
11,713,500 | 07/29/2012 22:22:44 | 1,325,480 | 04/11/2012 02:21:28 | 64 | 0 | iOS saving a bunch of UIImages and restore at later stage | I have a canvas that contains a bunch of UIImageViews and they editable, individually movable and stretchable.
Now, I like to save the state of that and close my app and at later times I like bring the canvas back up and still contain the movable UIImageViews like before.
I cannot save everything as .png file to my NSDocument directory because if I do that, later I try to restore that it will bring back as a whole png file, no more individaully moveable UIImageviews.
So, how do I save it and still retain the individually movable and editable canvas? | ios | uiimageview | null | null | null | null | open | iOS saving a bunch of UIImages and restore at later stage
===
I have a canvas that contains a bunch of UIImageViews and they editable, individually movable and stretchable.
Now, I like to save the state of that and close my app and at later times I like bring the canvas back up and still contain the movable UIImageViews like before.
I cannot save everything as .png file to my NSDocument directory because if I do that, later I try to restore that it will bring back as a whole png file, no more individaully moveable UIImageviews.
So, how do I save it and still retain the individually movable and editable canvas? | 0 |
11,713,501 | 07/29/2012 22:22:50 | 1,191,104 | 02/05/2012 20:22:34 | 147 | 2 | Different beetween mysql datetime timestap time | I want to get the current time when a login attempt is proccessed. I want to get the time retrived in probably date and hour/min/sec.
I have a database with a field called last_attempt which store the date and time for last login attempt.
Which of the types `Datetime`, `Timestamp`, `Time` or others should i use for the field ? And also what method in php should i use ? | php | mysql | time | null | null | null | open | Different beetween mysql datetime timestap time
===
I want to get the current time when a login attempt is proccessed. I want to get the time retrived in probably date and hour/min/sec.
I have a database with a field called last_attempt which store the date and time for last login attempt.
Which of the types `Datetime`, `Timestamp`, `Time` or others should i use for the field ? And also what method in php should i use ? | 0 |
11,713,507 | 07/29/2012 22:23:54 | 79,125 | 03/17/2009 17:34:49 | 2,285 | 118 | How do you configure grep to act more like ack? | How would you get grep to exclude the files that ack excludes (temp files and version control directories) without typing out the exclude patterns?
As [described here](http://blog.sanctum.geek.nz/default-grep-options/), you could use GREP_OPTIONS, but then you run into the [problems here](http://brainstorm.ubuntu.com/idea/24141/): scripts that use grep without clearing GREP_OPTIONS will break.
What is the better way? An alias? Or another script that wraps grep?
*While the obvious answer is `alias grep="ack -a"`, I'm academically interested in how to solve this problem without using ack.* | grep | null | null | null | null | null | open | How do you configure grep to act more like ack?
===
How would you get grep to exclude the files that ack excludes (temp files and version control directories) without typing out the exclude patterns?
As [described here](http://blog.sanctum.geek.nz/default-grep-options/), you could use GREP_OPTIONS, but then you run into the [problems here](http://brainstorm.ubuntu.com/idea/24141/): scripts that use grep without clearing GREP_OPTIONS will break.
What is the better way? An alias? Or another script that wraps grep?
*While the obvious answer is `alias grep="ack -a"`, I'm academically interested in how to solve this problem without using ack.* | 0 |
11,713,508 | 07/29/2012 22:23:55 | 1,560,501 | 07/29/2012 04:38:45 | 1 | 1 | How do I use Doctrine2 to work with GeoSpatial Queries using PostGIS? | I have a public facing app that is based on Postgres and PostGIS. I have tried Googling for hours but have been unable to find any documentation that can show some basic geospatial stuff like getting distance between two points using Doctrine2. Not being able to use an ORM is a big deal for me in terms of determining my database of choice. Any help in this matter would be greatly appreciated. | symfony-2.0 | doctrine2 | geospatial | postgis | null | null | open | How do I use Doctrine2 to work with GeoSpatial Queries using PostGIS?
===
I have a public facing app that is based on Postgres and PostGIS. I have tried Googling for hours but have been unable to find any documentation that can show some basic geospatial stuff like getting distance between two points using Doctrine2. Not being able to use an ORM is a big deal for me in terms of determining my database of choice. Any help in this matter would be greatly appreciated. | 0 |
11,713,511 | 07/29/2012 22:24:26 | 1,513,070 | 07/09/2012 20:30:50 | 42 | 0 | using called functions to call timers in visual basic 2010? | I'd like to know if there is a way to call a timer through a function. This function itself is called through an automated timer that is activated when the form loads.
Function callTimer(ByRef var1 As Integer, ByVal var2 As Integer)
'statements()
Media.SystemSounds.Beep.Play() 'to ensure that it is called
Call otherFunction(ByRef var3 As Integer) <-- how do you do this??
Return var1
End Function
I want to know how this can be done. VB gives me an error when I try this or something like this.
Thanks all! | vb.net | visual-studio-2010 | function | timer | null | null | open | using called functions to call timers in visual basic 2010?
===
I'd like to know if there is a way to call a timer through a function. This function itself is called through an automated timer that is activated when the form loads.
Function callTimer(ByRef var1 As Integer, ByVal var2 As Integer)
'statements()
Media.SystemSounds.Beep.Play() 'to ensure that it is called
Call otherFunction(ByRef var3 As Integer) <-- how do you do this??
Return var1
End Function
I want to know how this can be done. VB gives me an error when I try this or something like this.
Thanks all! | 0 |
11,713,516 | 07/29/2012 22:25:13 | 659,691 | 03/14/2011 22:48:40 | 136 | 0 | Why do C++/CLI interfaces need to be defined as virtual? | In the answer to the question here: http://stackoverflow.com/questions/880984/implementing-an-interface-declared-in-c-sharp-from-c-cli?rq=1, the statement was made that the implementation methods need to be marked **virtual**.
I am confused as to why? I haven't coded C++ in a long time and am making the transition back after many years of C#.
<insert standard apology for stupid question here> | c++-cli | null | null | null | null | null | open | Why do C++/CLI interfaces need to be defined as virtual?
===
In the answer to the question here: http://stackoverflow.com/questions/880984/implementing-an-interface-declared-in-c-sharp-from-c-cli?rq=1, the statement was made that the implementation methods need to be marked **virtual**.
I am confused as to why? I haven't coded C++ in a long time and am making the transition back after many years of C#.
<insert standard apology for stupid question here> | 0 |
11,713,520 | 07/29/2012 22:25:48 | 1,561,604 | 07/29/2012 22:18:44 | 1 | 0 | download android plugins to eclipse | New at this. I have downloaded eclipse and I'm trying to download the Android tools for eclipse. I've found the plug-in, checked the developer tools, and have gotten the message for calculating installation requirements and dependencies. When I go to install, I get the error message "Cannot complete the install because one or more required items could not be found" Can someone help me figure out why I keep getting this error? Thanks for the help! | eclipse-plugin | null | null | null | null | null | open | download android plugins to eclipse
===
New at this. I have downloaded eclipse and I'm trying to download the Android tools for eclipse. I've found the plug-in, checked the developer tools, and have gotten the message for calculating installation requirements and dependencies. When I go to install, I get the error message "Cannot complete the install because one or more required items could not be found" Can someone help me figure out why I keep getting this error? Thanks for the help! | 0 |
11,386,980 | 07/08/2012 21:46:49 | 1,062,643 | 11/23/2011 19:43:57 | 186 | 13 | UIImage resize with hard edges | I need a method for resizing UIImage like in photoshop with "nearest neighbour" resampling. I was looking for some, but everything I found was about CoreGraphics thicks to improve bicubic resampling quality. I have pixel-style design in my app, and a lot of stuff I create by pixel and then enlarge it with x5 multiplier (and it takes a lot of time, so I even close to writing a script for Photoshop). For example:
![enter image description here][1] > ![enter image description here][2]
But I really don't need this like result of resampling:
![enter image description here][3]
Maybe anyone will show me the right way.
[1]: http://i.stack.imgur.com/RSTOa.png
[2]: http://i.stack.imgur.com/D0zxR.png
[3]: http://i.stack.imgur.com/wA8Wj.png | objective-c | ios | xcode | uiimage | resize | null | open | UIImage resize with hard edges
===
I need a method for resizing UIImage like in photoshop with "nearest neighbour" resampling. I was looking for some, but everything I found was about CoreGraphics thicks to improve bicubic resampling quality. I have pixel-style design in my app, and a lot of stuff I create by pixel and then enlarge it with x5 multiplier (and it takes a lot of time, so I even close to writing a script for Photoshop). For example:
![enter image description here][1] > ![enter image description here][2]
But I really don't need this like result of resampling:
![enter image description here][3]
Maybe anyone will show me the right way.
[1]: http://i.stack.imgur.com/RSTOa.png
[2]: http://i.stack.imgur.com/D0zxR.png
[3]: http://i.stack.imgur.com/wA8Wj.png | 0 |
11,386,983 | 07/08/2012 21:47:30 | 871,140 | 07/30/2011 23:51:17 | 27 | 0 | compile .c with gcc | I'm trying to compile a program that have main.c and a lot of .c and .h files .
Is there any way to compile and link without passing all .c file in the gcc command
like
gcc main.c file.c file2.c -o main
| c | gcc | null | null | null | null | open | compile .c with gcc
===
I'm trying to compile a program that have main.c and a lot of .c and .h files .
Is there any way to compile and link without passing all .c file in the gcc command
like
gcc main.c file.c file2.c -o main
| 0 |
11,386,975 | 07/08/2012 21:45:37 | 1,443,481 | 06/08/2012 01:14:30 | 6 | 0 | Rails order method; column named :order | I have a model Exercises and it has columns of :circuit and :order (among others). In a view, I am trying to order the Exercises first by :circuit and then by :order. When I use the following:
@schedule.exercises.order(:circuit).each do |exercise|
it works as expected. However, when I try to add the :order column:
@schedule.exercises.order(:circuit, :order).each do |exercise|
I get the following error:
SQLite3::SQLException: near "order": syntax error: SELECT "exercises".* FROM "exercises" WHERE "exercises"."schedule_id" = 1 ORDER BY circuit, order
The same error also occurs when I pass the :order column alone:
@schedule.exercises.order(:order).each do |exercise|
SQLite3::SQLException: near "order": syntax error: SELECT "exercises".* FROM "exercises" WHERE "exercises"."schedule_id" = 1 ORDER BY order
I'm assuming that this is because the column name (:order) is the same as the SQL method name (`order`). I'm wondering if there's any way around this other than changing my column heading?
Thanks,
Stuart | sql | ruby-on-rails | columns | order | null | null | open | Rails order method; column named :order
===
I have a model Exercises and it has columns of :circuit and :order (among others). In a view, I am trying to order the Exercises first by :circuit and then by :order. When I use the following:
@schedule.exercises.order(:circuit).each do |exercise|
it works as expected. However, when I try to add the :order column:
@schedule.exercises.order(:circuit, :order).each do |exercise|
I get the following error:
SQLite3::SQLException: near "order": syntax error: SELECT "exercises".* FROM "exercises" WHERE "exercises"."schedule_id" = 1 ORDER BY circuit, order
The same error also occurs when I pass the :order column alone:
@schedule.exercises.order(:order).each do |exercise|
SQLite3::SQLException: near "order": syntax error: SELECT "exercises".* FROM "exercises" WHERE "exercises"."schedule_id" = 1 ORDER BY order
I'm assuming that this is because the column name (:order) is the same as the SQL method name (`order`). I'm wondering if there's any way around this other than changing my column heading?
Thanks,
Stuart | 0 |
11,386,987 | 07/08/2012 21:48:26 | 1,282,910 | 03/21/2012 08:58:06 | 81 | 5 | Download a single .txt using QFtp | I've got a problem with QFtp. I wanna download a single .txt file with a single line(8 bytes) from my server, so I've written the following code, but it doesn't work.
The file "actions.txt" were created in the folder1 directory. I can see the size of it pretty well in the client-side. But the file is not being written. I'm getting an empty file.
QFile* actionFile = new QFile("action.txt");
QFtp *ftp = new QFtp(parent);
void Dialog::getActionFile()
{
actionFile->open(QIODevice::WriteOnly);
ftp->connectToHost("mydomain.de");
ftp->login("user", "pw");
ftp->cd("folder1");
ftp->get("action.txt",actionFile);
ftp->close();
actionFile->close();
}
Thanks in advance.
| c++ | file | qt | ftp | null | null | open | Download a single .txt using QFtp
===
I've got a problem with QFtp. I wanna download a single .txt file with a single line(8 bytes) from my server, so I've written the following code, but it doesn't work.
The file "actions.txt" were created in the folder1 directory. I can see the size of it pretty well in the client-side. But the file is not being written. I'm getting an empty file.
QFile* actionFile = new QFile("action.txt");
QFtp *ftp = new QFtp(parent);
void Dialog::getActionFile()
{
actionFile->open(QIODevice::WriteOnly);
ftp->connectToHost("mydomain.de");
ftp->login("user", "pw");
ftp->cd("folder1");
ftp->get("action.txt",actionFile);
ftp->close();
actionFile->close();
}
Thanks in advance.
| 0 |
11,386,990 | 07/08/2012 21:48:50 | 1,225,456 | 02/22/2012 09:49:12 | 10 | 0 | show user's current location on a shapefile? | if I have a shapefile can I show user's location on it, of course dynamic pointer as we have in maps(on android, iphone,..)?
I want to have offline application so I decided to use shapefiles instead of maps, but I must show user's current location in application, is it possible?
if I can how? | shapefile | null | null | null | null | null | open | show user's current location on a shapefile?
===
if I have a shapefile can I show user's location on it, of course dynamic pointer as we have in maps(on android, iphone,..)?
I want to have offline application so I decided to use shapefiles instead of maps, but I must show user's current location in application, is it possible?
if I can how? | 0 |
11,386,994 | 07/08/2012 21:49:14 | 482,419 | 10/21/2010 00:54:53 | 83 | 5 | How to specify in the script to only use a specific version of perl? |
I have a perl script written for version 5.6.1 and which has dependencies on Oracle packages, DBI packages and more stuff. Everything is correctly installed and works.
Recently perl version 5.8.4 got installed and because those dependencies are not correctly set so the script fails.
'perl' command points to /program/perl_v5.8.4/bin/perl -- latest version
So, when I have to run my perl script I have to manually specify in command prompt
/program/perl_v5.6.1/bin/perl scriptName.pl
I tried adding following lines in script:
/program/perl_v5.6.1/bin/perl
use v5.6.1;
But, this means script has to take Perl version > 5.6.1
I found couple of related question which suggested:
1. To export path. But, I want the script for all the users without have to export path
2. Specify version greater than. But, I want to use just one specific version for this script.
3. use/require commands. Same issue as above.
My question: How to specify in the script to only use a specific version of perl?
| perl | null | null | null | null | null | open | How to specify in the script to only use a specific version of perl?
===
I have a perl script written for version 5.6.1 and which has dependencies on Oracle packages, DBI packages and more stuff. Everything is correctly installed and works.
Recently perl version 5.8.4 got installed and because those dependencies are not correctly set so the script fails.
'perl' command points to /program/perl_v5.8.4/bin/perl -- latest version
So, when I have to run my perl script I have to manually specify in command prompt
/program/perl_v5.6.1/bin/perl scriptName.pl
I tried adding following lines in script:
/program/perl_v5.6.1/bin/perl
use v5.6.1;
But, this means script has to take Perl version > 5.6.1
I found couple of related question which suggested:
1. To export path. But, I want the script for all the users without have to export path
2. Specify version greater than. But, I want to use just one specific version for this script.
3. use/require commands. Same issue as above.
My question: How to specify in the script to only use a specific version of perl?
| 0 |
11,386,874 | 07/08/2012 21:31:32 | 530,585 | 12/04/2010 17:05:36 | 1,168 | 18 | on('click') not being called | I have a this code:
$('input.error').on('click', function(){
$(this).removeClass('error').val($(this).data('submitval'));
});
But when I click on a form element with error class like so:
<input id="email" type="email" class="required error" placeholder="Enter Your Email here" name="email" value="">
Nothing happens, and the breakpoint I have set does not get called and none of the code executes. However if I set it to `$('input')` it does work. My understanding is that `.on` should cover for changes in the DOM after load. Am I missing something? | jquery | onclick | jquery-events | null | null | null | open | on('click') not being called
===
I have a this code:
$('input.error').on('click', function(){
$(this).removeClass('error').val($(this).data('submitval'));
});
But when I click on a form element with error class like so:
<input id="email" type="email" class="required error" placeholder="Enter Your Email here" name="email" value="">
Nothing happens, and the breakpoint I have set does not get called and none of the code executes. However if I set it to `$('input')` it does work. My understanding is that `.on` should cover for changes in the DOM after load. Am I missing something? | 0 |
11,661,672 | 07/26/2012 02:56:34 | 1,553,319 | 07/26/2012 02:32:13 | 1 | 0 | oracle declare user defined exception | Oracle SP not compiling
I am expierenced at MS SQL but taking a class in Oracle and for the life of me cannot figure out why this script for a stored Procedure will not work. I am getting an error in the variable declaration section at the first Exception variable. here is the error message:
=====================================================================================================
PLS-00103: Encountered the symbol "EXCEPTION" when expecting one
of the following:
in out <an identifier> <a double-quoted delimited-identifier> LONG_ double ref char time timestamp interval date binary national character nchar
-----------------------------------------------------------------------------------------------------
CREATE or REPLACE Procedure Movie_Rental_SP
(
Mv_ID IN Number,
Mem_ID IN Number,
Pay_ID IN Number,
Mv_Chk Number,
Mem_Chk Number,
Pay_Chk Number,
Qty_Chk Number,
--> next line is where the error points
UnKnown_Mv Exception,
UnKnown_Mem Exception,
UnKnown_Pay Exception,
UnAvail_Mv Exception )
IS
BEGIN
SELECT COUNT(Movie_ID) INTO Mv_Chk FROM MM_Movie WHERE Movie_ID = Mv_ID;
SELECT COUNT(Member_ID) INTO Mem_Chk FROM MM_Member WHERE Member_ID = Mem_ID;
SELECT COUNT(Payment_Methods_ID) INTO Pay_Chk FROM MM_Pay_Type WHERE Payment_Methods_ID = Pay_ID;
SELECT Movie_Qty INTO Qty_Chk FROM MM_Movie WHERE Movie_ID = Mv_ID;
IF Mv_Chk = 0 THEN RAISE UnKnown_Mv;
ELSE IF Mem_Chk = 0 THEN RAISE UnKnown_Mem;
ELSE IF Pay_Chk = 0 THEN RAISE UnKnown_Pay;
ELSE Qty_Chk = 0 THEN RAISE UnAvail_Mv;
END IF;
DECLARE New_ID NUMBER;
BEGIN
SELECT Max(Rental_ID)+1 INTO New_ID FROM MM_Rental;
EXCEPTION WHEN NO_DATA_FOUND THEN
New_ID := 1;
DBMS_OUTPUT.PUT_LINE ('There are no exsisting Rental IDs, ID set to 1');
END;
INSERT INTO MM_Rental VALUES (New_ID,Mem_ID,Mv_ID,Sysdate,Null,Pay_ID);
UPDATE MM_Movie SET Movie_Qty = Movie_Qty - 1 WHERE Movie_ID = Mv_ID;
EXCEPTION
WHEN UnKnown_Mv THEN
RAISE_APPLICATION_ERROR(-20001,'There is no movie with Movie ID of: '||Mv_ID||' Transaction cancelled.');
WHEN UnKnown_Mem THEN
RAISE_APPLICATION_ERROR(-20002,'No member exists with member ID: '||Mem_ID||' Transaction cancelled.');
WHEN UnKnown_Pay THEN
RAISE_APPLICATION_ERROR(-20003,'No payment type for: '||Pay_ID||' Transaction cancelled.');
WHEN UnAvail_Mv THEN
RAISE_APPLICATION_ERROR(-20004,'No movies available for: '||Mv_ID||' Transaction cancelled.');
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ('Error number: '||sqlcode);
DBMS_OUTPUT.PUT_LINE ('Error message: '||sqlerrm);
DBMS_OUTPUT.PUT_LINE('Unanticipated error. Contact your system administrator.');
END;
/
Any help would be greatly appreciated!
| oracle | null | null | null | null | null | open | oracle declare user defined exception
===
Oracle SP not compiling
I am expierenced at MS SQL but taking a class in Oracle and for the life of me cannot figure out why this script for a stored Procedure will not work. I am getting an error in the variable declaration section at the first Exception variable. here is the error message:
=====================================================================================================
PLS-00103: Encountered the symbol "EXCEPTION" when expecting one
of the following:
in out <an identifier> <a double-quoted delimited-identifier> LONG_ double ref char time timestamp interval date binary national character nchar
-----------------------------------------------------------------------------------------------------
CREATE or REPLACE Procedure Movie_Rental_SP
(
Mv_ID IN Number,
Mem_ID IN Number,
Pay_ID IN Number,
Mv_Chk Number,
Mem_Chk Number,
Pay_Chk Number,
Qty_Chk Number,
--> next line is where the error points
UnKnown_Mv Exception,
UnKnown_Mem Exception,
UnKnown_Pay Exception,
UnAvail_Mv Exception )
IS
BEGIN
SELECT COUNT(Movie_ID) INTO Mv_Chk FROM MM_Movie WHERE Movie_ID = Mv_ID;
SELECT COUNT(Member_ID) INTO Mem_Chk FROM MM_Member WHERE Member_ID = Mem_ID;
SELECT COUNT(Payment_Methods_ID) INTO Pay_Chk FROM MM_Pay_Type WHERE Payment_Methods_ID = Pay_ID;
SELECT Movie_Qty INTO Qty_Chk FROM MM_Movie WHERE Movie_ID = Mv_ID;
IF Mv_Chk = 0 THEN RAISE UnKnown_Mv;
ELSE IF Mem_Chk = 0 THEN RAISE UnKnown_Mem;
ELSE IF Pay_Chk = 0 THEN RAISE UnKnown_Pay;
ELSE Qty_Chk = 0 THEN RAISE UnAvail_Mv;
END IF;
DECLARE New_ID NUMBER;
BEGIN
SELECT Max(Rental_ID)+1 INTO New_ID FROM MM_Rental;
EXCEPTION WHEN NO_DATA_FOUND THEN
New_ID := 1;
DBMS_OUTPUT.PUT_LINE ('There are no exsisting Rental IDs, ID set to 1');
END;
INSERT INTO MM_Rental VALUES (New_ID,Mem_ID,Mv_ID,Sysdate,Null,Pay_ID);
UPDATE MM_Movie SET Movie_Qty = Movie_Qty - 1 WHERE Movie_ID = Mv_ID;
EXCEPTION
WHEN UnKnown_Mv THEN
RAISE_APPLICATION_ERROR(-20001,'There is no movie with Movie ID of: '||Mv_ID||' Transaction cancelled.');
WHEN UnKnown_Mem THEN
RAISE_APPLICATION_ERROR(-20002,'No member exists with member ID: '||Mem_ID||' Transaction cancelled.');
WHEN UnKnown_Pay THEN
RAISE_APPLICATION_ERROR(-20003,'No payment type for: '||Pay_ID||' Transaction cancelled.');
WHEN UnAvail_Mv THEN
RAISE_APPLICATION_ERROR(-20004,'No movies available for: '||Mv_ID||' Transaction cancelled.');
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ('Error number: '||sqlcode);
DBMS_OUTPUT.PUT_LINE ('Error message: '||sqlerrm);
DBMS_OUTPUT.PUT_LINE('Unanticipated error. Contact your system administrator.');
END;
/
Any help would be greatly appreciated!
| 0 |
11,661,674 | 07/26/2012 02:56:41 | 858,905 | 07/23/2011 02:38:48 | 326 | 8 | SQL Server view required for complex result set | This is probably impossible, but I want to create an SQL Server view to replace something I am doing mostly in C# instead of SQL at present.
In my database I have three tables (simplified for this question)…
**tblCourse** has columns CourseId, CourseNumber, CourseTitle, LocationId, PatternId, MiscFlag
**tblLocation** has columns LocationId, LocationTitle
**tblPattern** has columns PatternId, PatternTitle
There might be multiple courses with the same CourseNumber, but with different LocationId’s and different PatternId’s. There will be some courses with multiple PatternId’s at the same LocationId. Some courses may have the MiscFlag set to true and if at least one does then this flag would need to be set to true for that row.
The view is required to create a list of courses but return only 1 row for each CourseNumber, with the different CourseId’s returned for each PatternId at each LocationId.
This is presently done in C# code which iterates through a the data and combines all the data for each unique CourseNumber.
The reason I want to do this is (A) I can’t change the database structure, (B) there are thousands of records that are broken up in to pages and I would like to do paging at the SQL Server level instead of bringing down all data each time.
Essentially what I need is the following columns:
CourseNumber, CourseName, and then a column for each possible location which contains the CourseId and PatternId of any existing PatternIds that have this LocationId set. I guess that the CourseId and PatternId inside the Location column would need to be in some delimited list that I could convert in my C# code.
Here’s a few sample rows that I would be looking for as a result (columns delimited with commas):
**CourseNumber, CourseName, MiscFlag, LocationId1, LocationId2, LocationId3**
123, Course 1, False, NULL, 1828=2, NULL
456, Course 2, True, 255=3, 454=2, NULL
789, Course 3, False, NULL, NULL, 122=3&1556=2
(In this example I delimited the location data with CourseId=PatternId& CourseId=PatternId but it could be any way.)
I think I can probably work out how to do this with a whole bunch of sub-queries but I don’t think it would be very efficient. Maybe someone can set me in the right direction with some super efficient common table expression? | sql-server | null | null | null | null | null | open | SQL Server view required for complex result set
===
This is probably impossible, but I want to create an SQL Server view to replace something I am doing mostly in C# instead of SQL at present.
In my database I have three tables (simplified for this question)…
**tblCourse** has columns CourseId, CourseNumber, CourseTitle, LocationId, PatternId, MiscFlag
**tblLocation** has columns LocationId, LocationTitle
**tblPattern** has columns PatternId, PatternTitle
There might be multiple courses with the same CourseNumber, but with different LocationId’s and different PatternId’s. There will be some courses with multiple PatternId’s at the same LocationId. Some courses may have the MiscFlag set to true and if at least one does then this flag would need to be set to true for that row.
The view is required to create a list of courses but return only 1 row for each CourseNumber, with the different CourseId’s returned for each PatternId at each LocationId.
This is presently done in C# code which iterates through a the data and combines all the data for each unique CourseNumber.
The reason I want to do this is (A) I can’t change the database structure, (B) there are thousands of records that are broken up in to pages and I would like to do paging at the SQL Server level instead of bringing down all data each time.
Essentially what I need is the following columns:
CourseNumber, CourseName, and then a column for each possible location which contains the CourseId and PatternId of any existing PatternIds that have this LocationId set. I guess that the CourseId and PatternId inside the Location column would need to be in some delimited list that I could convert in my C# code.
Here’s a few sample rows that I would be looking for as a result (columns delimited with commas):
**CourseNumber, CourseName, MiscFlag, LocationId1, LocationId2, LocationId3**
123, Course 1, False, NULL, 1828=2, NULL
456, Course 2, True, 255=3, 454=2, NULL
789, Course 3, False, NULL, NULL, 122=3&1556=2
(In this example I delimited the location data with CourseId=PatternId& CourseId=PatternId but it could be any way.)
I think I can probably work out how to do this with a whole bunch of sub-queries but I don’t think it would be very efficient. Maybe someone can set me in the right direction with some super efficient common table expression? | 0 |
11,661,676 | 07/26/2012 02:57:00 | 769,326 | 05/25/2011 09:59:50 | 25 | 0 | How can I group XML nodes of the same name? | I am trying to figure out how to group XML nodes with the same name but different values.
The web service I'm using returns an XmlElement that looks like this:
<Items>
<Item>
<Name name="Name">Item 1</Name>
<Description name="Description">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</Description>
<AssociatedItems name="Associated Items">Item 2</AssociatedItems>
<AssociatedItems name="Associated Items">Item 3</AssociatedItems>
<AssociatedItems name="Associated Items">Item 4</AssociatedItems>
<AssociatedItems name="Associated Items">Item 5</AssociatedItems>
</Item>
</Items>
I am transforming each node into an HTML tag
protected void lnkItem_Click(object sender, EventArgs e)
{
LinkButton link = (LinkButton)sender;
GridViewRow row = (GridViewRow)link.Parent.Parent;
string id = gv.DataKeys[row.RowIndex]["id"].ToString();
PublicApiAsmxServiceSoapClient service = new PublicApiAsmxServiceSoapClient("PublicApiAsmxServiceSoap", WEB_SERVICE_URL);
XmlElement xml = service.ItemGetAsXml(PROFILE_CODE, APPLICATION_CODE, LANGUAGE, id);
XElement nodes = XElement.Parse(xml.InnerXml);
foreach (var node in nodes.Elements())
{
InsertHTML(node);
}
}
private void InsertHTML(XElement node)
{
if (node.Value == string.Empty)
return;
pnl.ContentTemplateContainer.Controls.Add(new LiteralControl(String.Format("<h3>{0}</h3>", node.Attribute("name").Value)));
pnl.ContentTemplateContainer.Controls.Add(new LiteralControl(String.Format("<p>{0}</p>", node.Value)));
}
With my code right now, the HTML output would be:
<h3>Name</h3>
<p>Item 1</p>
<h3>Description</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<h3>Associated Items</h3>
<p>Item 2</p>
<h3>Associated Items</h3>
<p>Item 3</p>
<h3>Associated Items</h3>
<p>Item 4</p>
<h3>Associated Items</h3>
<p>Item 5</p>
Is there a way to group the same nodes as an unordered list? Something like this, perhaps:
<h3>Name</h3>
<p>Item 1</p>
<h3>Description</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<h3>Associated Items</h3>
<ul>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
</ul>
Thank you! (Please be nice.) | c# | xml | xmlnode | null | null | null | open | How can I group XML nodes of the same name?
===
I am trying to figure out how to group XML nodes with the same name but different values.
The web service I'm using returns an XmlElement that looks like this:
<Items>
<Item>
<Name name="Name">Item 1</Name>
<Description name="Description">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</Description>
<AssociatedItems name="Associated Items">Item 2</AssociatedItems>
<AssociatedItems name="Associated Items">Item 3</AssociatedItems>
<AssociatedItems name="Associated Items">Item 4</AssociatedItems>
<AssociatedItems name="Associated Items">Item 5</AssociatedItems>
</Item>
</Items>
I am transforming each node into an HTML tag
protected void lnkItem_Click(object sender, EventArgs e)
{
LinkButton link = (LinkButton)sender;
GridViewRow row = (GridViewRow)link.Parent.Parent;
string id = gv.DataKeys[row.RowIndex]["id"].ToString();
PublicApiAsmxServiceSoapClient service = new PublicApiAsmxServiceSoapClient("PublicApiAsmxServiceSoap", WEB_SERVICE_URL);
XmlElement xml = service.ItemGetAsXml(PROFILE_CODE, APPLICATION_CODE, LANGUAGE, id);
XElement nodes = XElement.Parse(xml.InnerXml);
foreach (var node in nodes.Elements())
{
InsertHTML(node);
}
}
private void InsertHTML(XElement node)
{
if (node.Value == string.Empty)
return;
pnl.ContentTemplateContainer.Controls.Add(new LiteralControl(String.Format("<h3>{0}</h3>", node.Attribute("name").Value)));
pnl.ContentTemplateContainer.Controls.Add(new LiteralControl(String.Format("<p>{0}</p>", node.Value)));
}
With my code right now, the HTML output would be:
<h3>Name</h3>
<p>Item 1</p>
<h3>Description</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<h3>Associated Items</h3>
<p>Item 2</p>
<h3>Associated Items</h3>
<p>Item 3</p>
<h3>Associated Items</h3>
<p>Item 4</p>
<h3>Associated Items</h3>
<p>Item 5</p>
Is there a way to group the same nodes as an unordered list? Something like this, perhaps:
<h3>Name</h3>
<p>Item 1</p>
<h3>Description</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<h3>Associated Items</h3>
<ul>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
</ul>
Thank you! (Please be nice.) | 0 |
11,661,679 | 07/26/2012 02:57:28 | 129,475 | 06/26/2009 14:58:16 | 652 | 8 | Where in the Linux source does recognition of specific USB devices happen? | I have a specific USB device whose Linux driver source code I would like to examine. My understanding is that the first step a USB driver takes is to register itself capable of handling a device with a specific vendor ID and product ID. In my case, the vendor ID is `0BDA` and the product ID is `8187`. Given this information, is there a way I can find the source file that registers itself as capable of handling this device, with a view to then finding out what other source files actual implement the driver details?
For reference, I am on kernel `3.2.0-26`. I have tried a `grep -rl 8187 /usr/src`, but this lists a whole bunch of files, and I don't know where to start. | linux | usb | kernel | driver | null | null | open | Where in the Linux source does recognition of specific USB devices happen?
===
I have a specific USB device whose Linux driver source code I would like to examine. My understanding is that the first step a USB driver takes is to register itself capable of handling a device with a specific vendor ID and product ID. In my case, the vendor ID is `0BDA` and the product ID is `8187`. Given this information, is there a way I can find the source file that registers itself as capable of handling this device, with a view to then finding out what other source files actual implement the driver details?
For reference, I am on kernel `3.2.0-26`. I have tried a `grep -rl 8187 /usr/src`, but this lists a whole bunch of files, and I don't know where to start. | 0 |
11,661,681 | 07/26/2012 02:57:37 | 1,193,667 | 02/07/2012 02:13:29 | 1 | 0 | ant build android project tools/ant/build.xml:785 null returned: 139 | I use ant update an android project to target android-8 then use ant to build the project,but I got the error:
BUILD FAILED
/home/fengzhiping/android-sdk-linux/tools/ant/build.xml:769: The following error occurred while executing this line:
/home/fengzhiping/android-sdk-linux/tools/ant/build.xml:785: null returned: 139
Why ant build failure?Anyone can help me?
I use ubuntu11.04 and the android tools version is Android SDK Tools Revision 15. | android | ant | build | null | null | null | open | ant build android project tools/ant/build.xml:785 null returned: 139
===
I use ant update an android project to target android-8 then use ant to build the project,but I got the error:
BUILD FAILED
/home/fengzhiping/android-sdk-linux/tools/ant/build.xml:769: The following error occurred while executing this line:
/home/fengzhiping/android-sdk-linux/tools/ant/build.xml:785: null returned: 139
Why ant build failure?Anyone can help me?
I use ubuntu11.04 and the android tools version is Android SDK Tools Revision 15. | 0 |
11,661,682 | 07/26/2012 02:57:42 | 1,037,141 | 11/09/2011 07:47:41 | 28 | 0 | How to get each value in an array and show it in a listbox | Hi I am new to VB and I have problems with using array. My code is like that.
This is class FindFactorsObject.vb
Public Sub FindFactors()
count = 0
temp = Convert.ToInt32(Math.Sqrt(_x))
For i As Integer = 1 To temp
If _x Mod i = 0 Then
ReDim array(count)
array(count) = i
count += 1
End If
Next
So I created an array and stored the results. Now I want to display each value in my array in Form.vb and if it is possible can somebody teach me how to make delay for each of the displayed value. Thanks very much | vb.net-2010 | null | null | null | null | null | open | How to get each value in an array and show it in a listbox
===
Hi I am new to VB and I have problems with using array. My code is like that.
This is class FindFactorsObject.vb
Public Sub FindFactors()
count = 0
temp = Convert.ToInt32(Math.Sqrt(_x))
For i As Integer = 1 To temp
If _x Mod i = 0 Then
ReDim array(count)
array(count) = i
count += 1
End If
Next
So I created an array and stored the results. Now I want to display each value in my array in Form.vb and if it is possible can somebody teach me how to make delay for each of the displayed value. Thanks very much | 0 |
11,661,688 | 07/26/2012 02:58:19 | 222,403 | 12/01/2009 20:24:42 | 2,044 | 173 | Rails why am i getting undefined method | I'm trying to create a form where a user can type in their email and it will save it to the db. I want this form in the footer of every page.
I've generated NewsletterSignup via rails scaffolding.
Now i have this code in my /app/views/refinery/_footer.html.erb:
<%= form_for(@newsletter_signup) do |f| %>
<div class="field">
<%= f.label :email %><br />
<%= f.text_field :email %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
and when i try and load the page i get this error:
NoMethodError in Refinery/pages#home
Showing /Users/tomcaflisch/Sites/PersonalTrainingKT/app/views/refinery/_form.html.erb where line #1 raised:
undefined method `newsletter_signups_path' for #<#<Class:0x007fb84c769ba0>:0x007fb84c08d110>
Why is the method undefined? If i run rake routes i can see it exists:
newsletter_signups GET /newsletter_signups(.:format) newsletter_signups#index
POST /newsletter_signups(.:format) newsletter_signups#create
new_newsletter_signup GET /newsletter_signups/new(.:format) newsletter_signups#new
edit_newsletter_signup GET /newsletter_signups/:id/edit(.:format) newsletter_signups#edit
newsletter_signup GET /newsletter_signups/:id(.:format) newsletter_signups#show
PUT /newsletter_signups/:id(.:format) newsletter_signups#update
DELETE /newsletter_signups/:id(.:format) newsletter_signups#destroy
| ruby-on-rails | ruby | ruby-on-rails-3 | null | null | null | open | Rails why am i getting undefined method
===
I'm trying to create a form where a user can type in their email and it will save it to the db. I want this form in the footer of every page.
I've generated NewsletterSignup via rails scaffolding.
Now i have this code in my /app/views/refinery/_footer.html.erb:
<%= form_for(@newsletter_signup) do |f| %>
<div class="field">
<%= f.label :email %><br />
<%= f.text_field :email %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
and when i try and load the page i get this error:
NoMethodError in Refinery/pages#home
Showing /Users/tomcaflisch/Sites/PersonalTrainingKT/app/views/refinery/_form.html.erb where line #1 raised:
undefined method `newsletter_signups_path' for #<#<Class:0x007fb84c769ba0>:0x007fb84c08d110>
Why is the method undefined? If i run rake routes i can see it exists:
newsletter_signups GET /newsletter_signups(.:format) newsletter_signups#index
POST /newsletter_signups(.:format) newsletter_signups#create
new_newsletter_signup GET /newsletter_signups/new(.:format) newsletter_signups#new
edit_newsletter_signup GET /newsletter_signups/:id/edit(.:format) newsletter_signups#edit
newsletter_signup GET /newsletter_signups/:id(.:format) newsletter_signups#show
PUT /newsletter_signups/:id(.:format) newsletter_signups#update
DELETE /newsletter_signups/:id(.:format) newsletter_signups#destroy
| 0 |
11,661,692 | 07/26/2012 02:58:35 | 110,701 | 05/21/2009 19:07:36 | 653 | 52 | Why won't my paypal button center in my page | So I have a simple page:
www.kensandbox.info/centerthis
This is a simple html/css page and I'm trying to add a paypal button.
The problem is that I can't figure out how to center the button? I've tried adding the following:
<div align="center"> form code here </div>
No dice. I've even tried adding the center tag before the form.
The site code (simple html and css file) can be downloaded here:
www.kensandbox.info/centerthis/centerthis.zip
My guess is that one of the other CSS elements is overriding my change.
What am I missing?
Thanks | html | css | null | null | null | null | open | Why won't my paypal button center in my page
===
So I have a simple page:
www.kensandbox.info/centerthis
This is a simple html/css page and I'm trying to add a paypal button.
The problem is that I can't figure out how to center the button? I've tried adding the following:
<div align="center"> form code here </div>
No dice. I've even tried adding the center tag before the form.
The site code (simple html and css file) can be downloaded here:
www.kensandbox.info/centerthis/centerthis.zip
My guess is that one of the other CSS elements is overriding my change.
What am I missing?
Thanks | 0 |
11,661,696 | 07/26/2012 02:59:00 | 433,505 | 08/28/2010 03:22:31 | 6 | 0 | Need to add folder name to records in many files in many folders | I have about 50 million rows of data separated in many files in many folder names.
My problem is the folder name holds critical identifying data which I need to add as a record to every row in every file within the respective folder.
Assuming 200 folders with 200-250 files in each, what would be the easiest way to do this?
In other words I would like to:
1. loop through all folder names
2. loop through all file names
3. loop through all csv data within file names and append the folder name as a record to every row
It would be great if I could do it in PHP and MySQL
| php | mysql | null | null | null | null | open | Need to add folder name to records in many files in many folders
===
I have about 50 million rows of data separated in many files in many folder names.
My problem is the folder name holds critical identifying data which I need to add as a record to every row in every file within the respective folder.
Assuming 200 folders with 200-250 files in each, what would be the easiest way to do this?
In other words I would like to:
1. loop through all folder names
2. loop through all file names
3. loop through all csv data within file names and append the folder name as a record to every row
It would be great if I could do it in PHP and MySQL
| 0 |
11,661,607 | 07/26/2012 02:48:08 | 1,235,518 | 02/27/2012 12:00:42 | 37 | 1 | How to display data from Spring to Flex using Mate? | I am new to Flex, Mate, I created a spring service with a method that get a list of file names of a specific directory.
I have the dialog mxml file., it's working but still empty.
My question how to use mate to collect exposed data coming from Spring service and display it in my dialog mxml ?
thanks,
your help is appreciated. | flex | spring | service | mate | null | null | open | How to display data from Spring to Flex using Mate?
===
I am new to Flex, Mate, I created a spring service with a method that get a list of file names of a specific directory.
I have the dialog mxml file., it's working but still empty.
My question how to use mate to collect exposed data coming from Spring service and display it in my dialog mxml ?
thanks,
your help is appreciated. | 0 |
11,661,609 | 07/26/2012 02:48:53 | 471,313 | 10/10/2010 04:07:05 | 966 | 10 | Why this sinatra code is not working | I'm having a hard time figuring out what I'm doing wrong here. The result is empty and I'm looking it to return `hello` (calling the method `testing` through the `before` helper).
require 'rubygems'
require 'sinatra'
get '/' do
end
before do
testing
end
def testing
return "hello"
end | ruby | sinatra | null | null | null | null | open | Why this sinatra code is not working
===
I'm having a hard time figuring out what I'm doing wrong here. The result is empty and I'm looking it to return `hello` (calling the method `testing` through the `before` helper).
require 'rubygems'
require 'sinatra'
get '/' do
end
before do
testing
end
def testing
return "hello"
end | 0 |
11,327,432 | 07/04/2012 10:39:56 | 685,713 | 03/31/2011 12:34:13 | 73 | 3 | how to assign global NSInteger object in derived class | //AppDelegate.h
AppDelegate NSInteger myInt;
@property (readwrite, assign) NSInteger myInt;
//AppDelegate.m
@synthesize myInt;
//MyClass.h
AppDelegate *objAppDelegate;
//MyClass.m
objAppDelegate = (AppDelegate *) [[UIApplication sharedApplication] delegate];
When I try to assign a value to myInt like
objAppDelegate.myInt=(NSInteger *)0; // <--- this gives warning: something like incompatible pointer to integer conversion like that
So, how can I assign this variable? | iphone | objective-c | ios | delegates | null | null | open | how to assign global NSInteger object in derived class
===
//AppDelegate.h
AppDelegate NSInteger myInt;
@property (readwrite, assign) NSInteger myInt;
//AppDelegate.m
@synthesize myInt;
//MyClass.h
AppDelegate *objAppDelegate;
//MyClass.m
objAppDelegate = (AppDelegate *) [[UIApplication sharedApplication] delegate];
When I try to assign a value to myInt like
objAppDelegate.myInt=(NSInteger *)0; // <--- this gives warning: something like incompatible pointer to integer conversion like that
So, how can I assign this variable? | 0 |
11,327,436 | 07/04/2012 10:40:01 | 741,739 | 05/06/2011 12:23:16 | 396 | 2 | ActionScript reporting object co-ordinates to MATLAB | I'm running a Flash movie containing a moving object, used for a vision science experiment. I'm using an eye tracking device to monitor the eye movements made when following the stimulus on screen. Flash seems like a good option for controlling my stimulus as it allows vector scaling and smooth stimulus motion.
The eye tracker is running using MATLAB. I'd like to output the co-ordinates of the object from ActionScript to MATLAB so that in my final data output I can compare the stimulus position to eye position.
I understand that I may be able to communicate from AS to MATLAB via TCP/IP (although the actual procedure is alien to me), and wonder how I would go about extracting X and Y co-ordinates of an object (a circle object) and sending them to MATLAB?
Any help would be greatly appreciated | actionscript-3 | matlab | null | null | null | null | open | ActionScript reporting object co-ordinates to MATLAB
===
I'm running a Flash movie containing a moving object, used for a vision science experiment. I'm using an eye tracking device to monitor the eye movements made when following the stimulus on screen. Flash seems like a good option for controlling my stimulus as it allows vector scaling and smooth stimulus motion.
The eye tracker is running using MATLAB. I'd like to output the co-ordinates of the object from ActionScript to MATLAB so that in my final data output I can compare the stimulus position to eye position.
I understand that I may be able to communicate from AS to MATLAB via TCP/IP (although the actual procedure is alien to me), and wonder how I would go about extracting X and Y co-ordinates of an object (a circle object) and sending them to MATLAB?
Any help would be greatly appreciated | 0 |
11,327,437 | 07/04/2012 10:40:02 | 1,501,296 | 07/04/2012 10:35:10 | 1 | 0 | Facebook tab HTTPS iFrame issue with scrolling | I have an app (https://www.facebook.com/claritycomms/app_483675254991438)
It works fine when using http, however when moving to HTTPS the page no longer scrolls down, it is cut off by the iFrame.
I am not a coder - I built this app using Hype for Mac - the app worked fine for 3 days and now just doesn't :(
Can anyone help please
I have tried changing the setsize parameters in dashboard but the options arent even there
HELP!
I have 1300 fans who want to use the app!!
| facebook | iframe | https | scrolling | null | null | open | Facebook tab HTTPS iFrame issue with scrolling
===
I have an app (https://www.facebook.com/claritycomms/app_483675254991438)
It works fine when using http, however when moving to HTTPS the page no longer scrolls down, it is cut off by the iFrame.
I am not a coder - I built this app using Hype for Mac - the app worked fine for 3 days and now just doesn't :(
Can anyone help please
I have tried changing the setsize parameters in dashboard but the options arent even there
HELP!
I have 1300 fans who want to use the app!!
| 0 |
11,327,441 | 07/04/2012 10:40:15 | 1,247,964 | 03/04/2012 10:30:50 | 43 | 0 | How to play a video on canvas? | I would like to know how to play a video on a canvas. So far I think I have to separate the video into frames and just play the frames. I have managed to separate the video and I have all the frames in my project, but now I dont know what to do next. Also I have a lot of frames, like 200, should I just decode all 200 of them like:
BitmapFactory.decodeResource(getResources(), R.drawable.s001);
and then draw them to the canvas like:
c.drawBitmap(s001, centreX, centreY, null);?
That doesnt seem right at all. Could someone please help me. | android | animation | canvas | bitmap | frame | null | open | How to play a video on canvas?
===
I would like to know how to play a video on a canvas. So far I think I have to separate the video into frames and just play the frames. I have managed to separate the video and I have all the frames in my project, but now I dont know what to do next. Also I have a lot of frames, like 200, should I just decode all 200 of them like:
BitmapFactory.decodeResource(getResources(), R.drawable.s001);
and then draw them to the canvas like:
c.drawBitmap(s001, centreX, centreY, null);?
That doesnt seem right at all. Could someone please help me. | 0 |
11,327,423 | 07/04/2012 10:39:30 | 1,501,287 | 07/04/2012 10:29:12 | 1 | 0 | Print Preview color changes in excel generated by Jasper | I am using Jasper 4.0 to generate reports. The excel comes out perfectly fine but the print preview on different printer shows different colour and the same issue happens while printing the same. Any help on the same is deeply appreciated. | jasper-reports | null | null | null | null | null | open | Print Preview color changes in excel generated by Jasper
===
I am using Jasper 4.0 to generate reports. The excel comes out perfectly fine but the print preview on different printer shows different colour and the same issue happens while printing the same. Any help on the same is deeply appreciated. | 0 |
11,327,454 | 07/04/2012 10:41:04 | 556,876 | 12/29/2010 07:51:58 | 330 | 29 | identify a router that cuts certain port | Is there a way to identify which particular router between me and some server blocks connections on certain port?
I am in a hotel in Thailand, where they have recently changed some settings in their equipment, and now I cannot reach any of my servers in Europe and USA by SSH / port 22. More traditional ports like 80 or 21 are open.
`traceroute` command shows each particular router in the middle. But is there a way to identify one that filters out port 22? | routing | firewall | network-protocols | traceroute | null | 07/04/2012 11:13:45 | off topic | identify a router that cuts certain port
===
Is there a way to identify which particular router between me and some server blocks connections on certain port?
I am in a hotel in Thailand, where they have recently changed some settings in their equipment, and now I cannot reach any of my servers in Europe and USA by SSH / port 22. More traditional ports like 80 or 21 are open.
`traceroute` command shows each particular router in the middle. But is there a way to identify one that filters out port 22? | 2 |
11,649,559 | 07/25/2012 12:19:41 | 949,533 | 09/16/2011 20:26:34 | 18 | 2 | State object in django | My problem is as follows:
I am implementing a labeling system for a machine learning problem.
So in short: A complex object should get a simple label information (like a tag).
There should be just one label per object and the set of labels is limited and static.
(e.g.: I want to label all attributs of one animal objects to the information CAT, DOG, etc.)
So I have an item object. I want to save this as a tupel with one of my label-objects (myAnimal, label). This object should only carry ONE information (e.g. DOG). How can I accomplish that?
I thought of an object that holds some booleans and the one boolean I want gets set, but that seems to be not a nice solution since multiple booleans could be set.
I googled for a simple enum-like solution but found nothing satisfying.
It would be nice if you could help me out here ;) | python | django | state | statemachine | null | null | open | State object in django
===
My problem is as follows:
I am implementing a labeling system for a machine learning problem.
So in short: A complex object should get a simple label information (like a tag).
There should be just one label per object and the set of labels is limited and static.
(e.g.: I want to label all attributs of one animal objects to the information CAT, DOG, etc.)
So I have an item object. I want to save this as a tupel with one of my label-objects (myAnimal, label). This object should only carry ONE information (e.g. DOG). How can I accomplish that?
I thought of an object that holds some booleans and the one boolean I want gets set, but that seems to be not a nice solution since multiple booleans could be set.
I googled for a simple enum-like solution but found nothing satisfying.
It would be nice if you could help me out here ;) | 0 |
11,650,367 | 07/25/2012 13:04:13 | 1,382,672 | 05/08/2012 16:59:24 | 55 | 0 | converting html tags and the content to string | my question is I need to create a string from the result of event.content. Event.content returns me an entry including html tags. I can use it like container.innerHTML = event.content. I need the event.content as a string. I tried to do something like this:
var a = '' + event.content;
But it doesn't work. Here the result of event.content:
<img src="http://image.weather.com/web/common/wxicons/31/30.gif?12122006" alt="" />Partly Cloudy, and 84 ° F. For more details?
I can't convert this into string in javascript. Is it possible? I also tried String(event.content).
| javascript | null | null | null | null | null | open | converting html tags and the content to string
===
my question is I need to create a string from the result of event.content. Event.content returns me an entry including html tags. I can use it like container.innerHTML = event.content. I need the event.content as a string. I tried to do something like this:
var a = '' + event.content;
But it doesn't work. Here the result of event.content:
<img src="http://image.weather.com/web/common/wxicons/31/30.gif?12122006" alt="" />Partly Cloudy, and 84 ° F. For more details?
I can't convert this into string in javascript. Is it possible? I also tried String(event.content).
| 0 |
11,649,546 | 07/25/2012 12:18:56 | 169,662 | 09/07/2009 11:47:30 | 63 | 0 | Python interface supported link speed | What is the preferred and cross-platform (Ubuntu, Redhat) way to get supported interface link speed?
i am familiar with ethtool, but i would like an option not to use an external tool, but only python. | python | networking | null | null | null | null | open | Python interface supported link speed
===
What is the preferred and cross-platform (Ubuntu, Redhat) way to get supported interface link speed?
i am familiar with ethtool, but i would like an option not to use an external tool, but only python. | 0 |
11,650,372 | 07/25/2012 13:04:35 | 1,496,648 | 07/02/2012 16:39:54 | 1 | 0 | how to read subfolder | how to make read all sub folders on shared mailbox? by now I can only read Inbox
<pre>shared mailbox
Inbox
---test
---AAAA
-----AAAA
---BBB
</pre>
Dim WithEvents myInboxMailItem As Outlook.Items
Dim msg As Outlook.MailItem
Private Sub myInboxMailItem_ItemAdd(ByVal Item As Object)
If TypeOf Item Is Outlook.MailItem Then
Set msg = Item
If InStr(UCase(msg.Subject), "AAA") <> 0 Or InStr(UCase(msg.Subject), "TEST") <> 0 Then
Call MsgBox(msg.Subject, vbOKOnly, "Message")
End If
End If
End Sub
Private Sub Initialize_Handler()
Dim fldInbox As Outlook.MAPIFolder
Dim gnspNameSpace As Outlook.NameSpace
Set gnspNameSpace = Outlook.GetNamespace("MAPI") 'Outlook Object
Set fldInbox = gnspNameSpace.Folders("shared mailbox").Folders("Inbox") '.Folders("test") here I have problem
Set myInboxMailItem = fldInbox.Items
End Sub
Private Sub Application_Startup()
Call Initialize_Handler
End Sub
| folder | shared | subfolder | null | null | null | open | how to read subfolder
===
how to make read all sub folders on shared mailbox? by now I can only read Inbox
<pre>shared mailbox
Inbox
---test
---AAAA
-----AAAA
---BBB
</pre>
Dim WithEvents myInboxMailItem As Outlook.Items
Dim msg As Outlook.MailItem
Private Sub myInboxMailItem_ItemAdd(ByVal Item As Object)
If TypeOf Item Is Outlook.MailItem Then
Set msg = Item
If InStr(UCase(msg.Subject), "AAA") <> 0 Or InStr(UCase(msg.Subject), "TEST") <> 0 Then
Call MsgBox(msg.Subject, vbOKOnly, "Message")
End If
End If
End Sub
Private Sub Initialize_Handler()
Dim fldInbox As Outlook.MAPIFolder
Dim gnspNameSpace As Outlook.NameSpace
Set gnspNameSpace = Outlook.GetNamespace("MAPI") 'Outlook Object
Set fldInbox = gnspNameSpace.Folders("shared mailbox").Folders("Inbox") '.Folders("test") here I have problem
Set myInboxMailItem = fldInbox.Items
End Sub
Private Sub Application_Startup()
Call Initialize_Handler
End Sub
| 0 |
11,650,373 | 07/25/2012 13:04:38 | 1,495,318 | 07/02/2012 06:53:33 | 69 | 6 | Can I show PayPal frame to show payment reports for mine users? | I have task to provide user with financial reports. <p>My application is sharing profit with users for using special. advertisement.<p>
PayPal report page should actually be a PayPal site frame inserted into our site - which is the actual Paypal reporting system OF OUR PAYPAL ACCOUNT that shows the transfers for that specific user. <p>Is it possible to do ? As I know PayPal is blocking frames or I'm wrong ?
<p>If it is possible I should provide some role to user when user sign up on my site, yes ?
| ruby-on-rails | paypal | reporting | paypal-api | null | null | open | Can I show PayPal frame to show payment reports for mine users?
===
I have task to provide user with financial reports. <p>My application is sharing profit with users for using special. advertisement.<p>
PayPal report page should actually be a PayPal site frame inserted into our site - which is the actual Paypal reporting system OF OUR PAYPAL ACCOUNT that shows the transfers for that specific user. <p>Is it possible to do ? As I know PayPal is blocking frames or I'm wrong ?
<p>If it is possible I should provide some role to user when user sign up on my site, yes ?
| 0 |
11,650,377 | 07/25/2012 13:04:49 | 1,538,127 | 07/19/2012 13:57:04 | 123 | 9 | validate a xml file against a xsd using php | how to validate a xml file against a xsd? there is domdocument::schemaValidate() but It does not tell where are the errors. is there any class for that? does it have any worth making that parser from scratch? or is it just reinventing he wheel, | php | xml | validation | xsd | xml-parsing | null | open | validate a xml file against a xsd using php
===
how to validate a xml file against a xsd? there is domdocument::schemaValidate() but It does not tell where are the errors. is there any class for that? does it have any worth making that parser from scratch? or is it just reinventing he wheel, | 0 |
11,650,382 | 07/25/2012 13:05:01 | 131,433 | 07/01/2009 01:11:25 | 33,515 | 1,535 | ExtJS file upload ajax response strips HTML from inside string inside JSON | I have a form with a fileupload control in it, and I call form.submit with a success function.
My server side does the usual trick of setting the content type to text/html to get it to arrive in one piece.
In the success function, action.response.responseText does contain the JSON which I sent.
When it leaves the server, it looks like:
{
html: "<div>a div</div>"
}
When it arrives in the success function, the tags are missing. What's going on? Do I need to put some sort of html cdata wrapper around the entire response on the server to avoid this?
| ajax | iframe | extjs4 | null | null | null | open | ExtJS file upload ajax response strips HTML from inside string inside JSON
===
I have a form with a fileupload control in it, and I call form.submit with a success function.
My server side does the usual trick of setting the content type to text/html to get it to arrive in one piece.
In the success function, action.response.responseText does contain the JSON which I sent.
When it leaves the server, it looks like:
{
html: "<div>a div</div>"
}
When it arrives in the success function, the tags are missing. What's going on? Do I need to put some sort of html cdata wrapper around the entire response on the server to avoid this?
| 0 |
11,650,383 | 07/25/2012 13:05:10 | 1,371,876 | 05/03/2012 07:53:41 | 145 | 6 | viewPanel with category filter showing empty rows if filter is not set | I'm having this categorized view displayed in a view panel where the category column is not shown. Instead I'm displaying a combobox above the viewPanel where users can select from all the categories available (see screenshot below). The combo is bound to a scopeVariable and is refreshing the viewPanel onChange. The viewPanel has a computed categoryFilter reading from the same scopeVar. That all works nicely.
Now I also have implemented a "SHOW ALL" value to be selected from the combo which programmatically sets the cat filter to NULL, this way forcing the viewPanel to show all entries (to be exact, I used a * to show them all). Also this works fine, with the drawback that now the view is showing empty rows where the category entries would be shown normally (in the screenshot you can see 2 entries for the category "edcom GmbH" which aren't separated by an empty row):
![enter image description here][1]
One way to get rid of those empty rows would be to assign a computed rowClass based on the fact wether an entry is a category or not, and then disable its display using css. But I would prefer those rows not being rendered in the first place.
Can this be done at all using a viewPanel, and how? Or do I have to use other controls like a repeat or a dataTable maybe?
Thanks in advance,
Lothar
[1]: http://i.stack.imgur.com/cVOrc.png | xpages | xpages-ssjs | null | null | null | null | open | viewPanel with category filter showing empty rows if filter is not set
===
I'm having this categorized view displayed in a view panel where the category column is not shown. Instead I'm displaying a combobox above the viewPanel where users can select from all the categories available (see screenshot below). The combo is bound to a scopeVariable and is refreshing the viewPanel onChange. The viewPanel has a computed categoryFilter reading from the same scopeVar. That all works nicely.
Now I also have implemented a "SHOW ALL" value to be selected from the combo which programmatically sets the cat filter to NULL, this way forcing the viewPanel to show all entries (to be exact, I used a * to show them all). Also this works fine, with the drawback that now the view is showing empty rows where the category entries would be shown normally (in the screenshot you can see 2 entries for the category "edcom GmbH" which aren't separated by an empty row):
![enter image description here][1]
One way to get rid of those empty rows would be to assign a computed rowClass based on the fact wether an entry is a category or not, and then disable its display using css. But I would prefer those rows not being rendered in the first place.
Can this be done at all using a viewPanel, and how? Or do I have to use other controls like a repeat or a dataTable maybe?
Thanks in advance,
Lothar
[1]: http://i.stack.imgur.com/cVOrc.png | 0 |
11,650,385 | 07/25/2012 13:05:16 | 1,242,664 | 03/01/2012 12:45:49 | 202 | 31 | Non-jailbreak VNC server for iOS? Remotelly use an iOS device? | I know there is an existing app named veency that converts the iPhone/iPad in a VNC server. With another program like tightvnc on the mac or windows, you can remotely use an iOs device from your windows/mac. The problem is, I cannot find any existing app or program that does that on an normal iOS device (not jailbreaked). What I find is the opposite, programs that remotely use a desktop computer from the iPad.
Does anyone know any app or method to turn an iOS device in a VNC server?
Thanks in advance for your help. | iphone | ios | ipad | vnc | null | null | open | Non-jailbreak VNC server for iOS? Remotelly use an iOS device?
===
I know there is an existing app named veency that converts the iPhone/iPad in a VNC server. With another program like tightvnc on the mac or windows, you can remotely use an iOs device from your windows/mac. The problem is, I cannot find any existing app or program that does that on an normal iOS device (not jailbreaked). What I find is the opposite, programs that remotely use a desktop computer from the iPad.
Does anyone know any app or method to turn an iOS device in a VNC server?
Thanks in advance for your help. | 0 |
11,650,387 | 07/25/2012 13:05:20 | 1,312,399 | 04/04/2012 09:04:50 | 1 | 0 | .net +oracle error | I am using visual studio2005 and oracle 10g database.frame work is 2.0
this is webapplication.
my application do not have build errors.Build is succeessed.
But i am getting run time error.
The below thing is the error which is i am getting.
Exception Details: System.DllNotFoundException: Unable to load DLL 'OraOps10w.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
please help me in this.that would be greatful for me.
Thanks,
Ashok.
| oracle10g | null | null | null | null | null | open | .net +oracle error
===
I am using visual studio2005 and oracle 10g database.frame work is 2.0
this is webapplication.
my application do not have build errors.Build is succeessed.
But i am getting run time error.
The below thing is the error which is i am getting.
Exception Details: System.DllNotFoundException: Unable to load DLL 'OraOps10w.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
please help me in this.that would be greatful for me.
Thanks,
Ashok.
| 0 |
11,650,375 | 07/25/2012 13:04:41 | 828,867 | 07/05/2011 01:16:47 | 1,575 | 63 | Downloading files using Java randomly freezes | When I try to download a file (in this case it's just an image but the real application is an updating mechanism), the `InputStream` seems to freeze on `read`. I'm pretty sure my code is okay, so I'm wondering why this happens and if it's just on my computer. Could someone please run this? Thank you kindly.
import java.io.*;
import java.net.URL;
public class FileDownloader {
public final static int BUFFER_LENGTH = 1 << 14;
public static void main(String [] args) throws Exception{
URL url = new URL("http://host.trivialbeing.org/up/tdk-aug3-jokr-high-res-2.jpg");
download(url, new File("joker.jpg"));
}
public static File download(URL url, File dest) throws IOException {
FileOutputStream fos = new FileOutputStream(dest);
BufferedOutputStream out = new BufferedOutputStream(fos);
BufferedInputStream in = new BufferedInputStream(url.openStream());
byte[] buf = new byte[BUFFER_LENGTH];
int bytesRead;
int bytesWritten = 0;
while ((bytesRead = in.read(buf, 0, BUFFER_LENGTH)) != -1) {
out.write(buf, 0, bytesRead);
bytesWritten += bytesRead;
System.out.println(bytesWritten / 1024 + " Kb written");
}
in.close();
out.close();
return dest;
}
} | java | io | null | null | null | null | open | Downloading files using Java randomly freezes
===
When I try to download a file (in this case it's just an image but the real application is an updating mechanism), the `InputStream` seems to freeze on `read`. I'm pretty sure my code is okay, so I'm wondering why this happens and if it's just on my computer. Could someone please run this? Thank you kindly.
import java.io.*;
import java.net.URL;
public class FileDownloader {
public final static int BUFFER_LENGTH = 1 << 14;
public static void main(String [] args) throws Exception{
URL url = new URL("http://host.trivialbeing.org/up/tdk-aug3-jokr-high-res-2.jpg");
download(url, new File("joker.jpg"));
}
public static File download(URL url, File dest) throws IOException {
FileOutputStream fos = new FileOutputStream(dest);
BufferedOutputStream out = new BufferedOutputStream(fos);
BufferedInputStream in = new BufferedInputStream(url.openStream());
byte[] buf = new byte[BUFFER_LENGTH];
int bytesRead;
int bytesWritten = 0;
while ((bytesRead = in.read(buf, 0, BUFFER_LENGTH)) != -1) {
out.write(buf, 0, bytesRead);
bytesWritten += bytesRead;
System.out.println(bytesWritten / 1024 + " Kb written");
}
in.close();
out.close();
return dest;
}
} | 0 |
11,734,147 | 07/31/2012 06:10:55 | 1,544,681 | 07/23/2012 00:40:07 | 141 | 1 | How to access create query method in symfony repository | I have the class user repository
class userRepository extends EntityRepository
{
function getuserData($id)
{$query = $this->createQuery(
'SELECT c FROM AcmeBundle:User c WHERE c.id = :id ORDER BY c.id ASC')
->setParameter('id', $id);
return $query->getResult();
}
}
I am getting this error
> Undefined method 'createQuery'. The method name must start with either
> findBy or findOneBy!
| php | symfony-2.0 | doctrine2 | null | null | null | open | How to access create query method in symfony repository
===
I have the class user repository
class userRepository extends EntityRepository
{
function getuserData($id)
{$query = $this->createQuery(
'SELECT c FROM AcmeBundle:User c WHERE c.id = :id ORDER BY c.id ASC')
->setParameter('id', $id);
return $query->getResult();
}
}
I am getting this error
> Undefined method 'createQuery'. The method name must start with either
> findBy or findOneBy!
| 0 |
11,734,148 | 07/31/2012 06:10:58 | 960,954 | 09/23/2011 10:43:59 | 9 | 0 | how to get child user control by id from a parent panel user control? | for eg. my code is
void abc(usercontrolclass ucc)
{
this.panel.Controls.Add(ucc);
}
void def()
{
usercontrolclass ucc1 = this.panel.Controls.GetChildUserControl(ucc);
}
Note "GetChildUserControl" is not a valid function what i require is a method or
function which i can use to get ucc. | c# | .net | visual-studio | null | null | null | open | how to get child user control by id from a parent panel user control?
===
for eg. my code is
void abc(usercontrolclass ucc)
{
this.panel.Controls.Add(ucc);
}
void def()
{
usercontrolclass ucc1 = this.panel.Controls.GetChildUserControl(ucc);
}
Note "GetChildUserControl" is not a valid function what i require is a method or
function which i can use to get ucc. | 0 |
11,734,150 | 07/31/2012 06:11:08 | 1,550,515 | 07/25/2012 04:48:35 | 1 | 2 | How set Localizable.strings for multi language application? | I am working on one application in it i want to give three language support English, Dutch and German. i want when user select his language from list of three language whole application language change as user selection. | iphone | null | null | null | null | null | open | How set Localizable.strings for multi language application?
===
I am working on one application in it i want to give three language support English, Dutch and German. i want when user select his language from list of three language whole application language change as user selection. | 0 |
11,734,249 | 07/31/2012 06:20:06 | 1,381,267 | 05/08/2012 05:43:52 | 74 | 0 | centrally two button not looking good blackberry | i am developing one app in which i want to set User interface where Two button are make align with `center` and both are custom button which background are fill with bitmap. and text are also center of that button.
but problem is here those two button are not set properly.
second button are gone behine from first and its bitmap height is also decrease compare to first button.
for custome button i have take same CustomeButton class.
**here is code::**
CustomButtonField aboutM1 = new CustomButtonField(0,"About G1",registerbg,registerbg,Field.FOCUSABLE,0x324F85);
add(new RichTextField(Field.NON_FOCUSABLE));
// CustomButtonField2 ForgotPass = new CustomButtonField2("Forgot Password?",0x324F85);
CustomButtonField ForgotPass = new CustomButtonField(0,"Forgot Password?",registerbg,registerbg,Field.FOCUSABLE,0x324F85);
add(new RichTextField(Field.NON_FOCUSABLE));
VerticalFieldManager bottomVFM = new VerticalFieldManager(USE_ALL_WIDTH);
HorizontalFieldManager bottomHFM = new HorizontalFieldManager(FIELD_HCENTER);
bottomHFM.add(aboutM1);
bottomHFM.add(ForgotPass);
bottomVFM.add(bottomHFM);
add(bottomVFM);
**Custom Button ::**
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.*;
public class CustomButtonField extends Field
{
Bitmap Unfocus_img, Focus_img, current_pic;
int width;
String text;
Font font;
int custColor;
CustomButtonField(int width, String text, Bitmap onFocus, Bitmap onUnfocus, long style,int custColor)
{
super(style);
Unfocus_img = onUnfocus;
Focus_img = onFocus;
current_pic = onFocus;
this.text = text;
this.width = width;
this.custColor = custColor;
}
protected void layout(int width, int height)
{
setExtent(current_pic.getWidth(), current_pic.getHeight());
}
protected void paint(Graphics graphics)
{
try
{
FontFamily fntFamily = FontFamily.forName("BBAlpha Sans");
font = fntFamily.getFont(Font.BOLD,20);
}
catch(Exception e)
{
font = Font.getDefault();
}
graphics.setFont(font);
graphics.setColor(custColor);
int xText = (getWidth() - font.getAdvance(text)) / 2;
int yText = (getHeight() - font.getHeight()) / 2;
graphics.drawBitmap(0, 0, current_pic.getWidth(), current_pic.getHeight(), current_pic , 0 , 0);
graphics.drawText(text, xText, yText);
/* graphics.drawBitmap(0, 0, current_pic.getWidth(), current_pic.getHeight(), current_pic , 0 , 0);
graphics.drawText(text, width , 7);*/
graphics.setDrawingStyle(Graphics.HCENTER | Graphics.VCENTER, true);
}
protected void onFocus(int direction)
{
super.onFocus(direction);
current_pic = Unfocus_img;
this.invalidate();
}
protected void drawFocus(Graphics graphics, boolean on)
{
}
protected void onUnfocus()
{
super.onUnfocus();
current_pic = Focus_img;
invalidate();
}
public boolean isFocusable() {
return true;
}
protected boolean navigationClick(int status, int time) {
fieldChangeNotify(0);
return true;
}
}
![enter image description here][1]
[1]: http://i.stack.imgur.com/zb3pa.png | java | blackberry | null | null | null | null | open | centrally two button not looking good blackberry
===
i am developing one app in which i want to set User interface where Two button are make align with `center` and both are custom button which background are fill with bitmap. and text are also center of that button.
but problem is here those two button are not set properly.
second button are gone behine from first and its bitmap height is also decrease compare to first button.
for custome button i have take same CustomeButton class.
**here is code::**
CustomButtonField aboutM1 = new CustomButtonField(0,"About G1",registerbg,registerbg,Field.FOCUSABLE,0x324F85);
add(new RichTextField(Field.NON_FOCUSABLE));
// CustomButtonField2 ForgotPass = new CustomButtonField2("Forgot Password?",0x324F85);
CustomButtonField ForgotPass = new CustomButtonField(0,"Forgot Password?",registerbg,registerbg,Field.FOCUSABLE,0x324F85);
add(new RichTextField(Field.NON_FOCUSABLE));
VerticalFieldManager bottomVFM = new VerticalFieldManager(USE_ALL_WIDTH);
HorizontalFieldManager bottomHFM = new HorizontalFieldManager(FIELD_HCENTER);
bottomHFM.add(aboutM1);
bottomHFM.add(ForgotPass);
bottomVFM.add(bottomHFM);
add(bottomVFM);
**Custom Button ::**
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.*;
public class CustomButtonField extends Field
{
Bitmap Unfocus_img, Focus_img, current_pic;
int width;
String text;
Font font;
int custColor;
CustomButtonField(int width, String text, Bitmap onFocus, Bitmap onUnfocus, long style,int custColor)
{
super(style);
Unfocus_img = onUnfocus;
Focus_img = onFocus;
current_pic = onFocus;
this.text = text;
this.width = width;
this.custColor = custColor;
}
protected void layout(int width, int height)
{
setExtent(current_pic.getWidth(), current_pic.getHeight());
}
protected void paint(Graphics graphics)
{
try
{
FontFamily fntFamily = FontFamily.forName("BBAlpha Sans");
font = fntFamily.getFont(Font.BOLD,20);
}
catch(Exception e)
{
font = Font.getDefault();
}
graphics.setFont(font);
graphics.setColor(custColor);
int xText = (getWidth() - font.getAdvance(text)) / 2;
int yText = (getHeight() - font.getHeight()) / 2;
graphics.drawBitmap(0, 0, current_pic.getWidth(), current_pic.getHeight(), current_pic , 0 , 0);
graphics.drawText(text, xText, yText);
/* graphics.drawBitmap(0, 0, current_pic.getWidth(), current_pic.getHeight(), current_pic , 0 , 0);
graphics.drawText(text, width , 7);*/
graphics.setDrawingStyle(Graphics.HCENTER | Graphics.VCENTER, true);
}
protected void onFocus(int direction)
{
super.onFocus(direction);
current_pic = Unfocus_img;
this.invalidate();
}
protected void drawFocus(Graphics graphics, boolean on)
{
}
protected void onUnfocus()
{
super.onUnfocus();
current_pic = Focus_img;
invalidate();
}
public boolean isFocusable() {
return true;
}
protected boolean navigationClick(int status, int time) {
fieldChangeNotify(0);
return true;
}
}
![enter image description here][1]
[1]: http://i.stack.imgur.com/zb3pa.png | 0 |
11,734,250 | 07/31/2012 06:20:07 | 1,437,112 | 06/05/2012 10:32:16 | 22 | 3 | Search relevance with Ranking. Rank is 0 | This is regarding FREETEXTTABLE() keyword in Full Text search Sql sever 2008.
I have the following table (attached)![enter image description here][1] on which I have to search
[1]: http://i.stack.imgur.com/fdkzq.jpg
I want to find 'Everybody'.
SELECT a.Id as PublicationID, null as PageNumber, null as Searchtext, a.Title as Title, null as AuthPublisher_Name, null as About_AuthorPublisher, null as ContentType , TitleSearch.[Rank] * 100000 AS [Rank]
FROM Publication a
INNER JOIN FREETEXTTABLE(Publication,Title, 'Everybody') TitleSearch ON a.Id = TitleSearch.[Key]
The results are coming, but RANK = 0.
Why is the Rank coming 0.
Also, when I search 'filler', I am getting the search result with proper rank.
Why is the distinction ?
Is it because, everybody appears frequently, But that doesnt make any sense
Note : I dont want to use CONTAINSTABLE()....
Could anybody help me ??
Thanks,
marcus
| full-text-search | sql-server-2008-r2 | ranking | null | null | null | open | Search relevance with Ranking. Rank is 0
===
This is regarding FREETEXTTABLE() keyword in Full Text search Sql sever 2008.
I have the following table (attached)![enter image description here][1] on which I have to search
[1]: http://i.stack.imgur.com/fdkzq.jpg
I want to find 'Everybody'.
SELECT a.Id as PublicationID, null as PageNumber, null as Searchtext, a.Title as Title, null as AuthPublisher_Name, null as About_AuthorPublisher, null as ContentType , TitleSearch.[Rank] * 100000 AS [Rank]
FROM Publication a
INNER JOIN FREETEXTTABLE(Publication,Title, 'Everybody') TitleSearch ON a.Id = TitleSearch.[Key]
The results are coming, but RANK = 0.
Why is the Rank coming 0.
Also, when I search 'filler', I am getting the search result with proper rank.
Why is the distinction ?
Is it because, everybody appears frequently, But that doesnt make any sense
Note : I dont want to use CONTAINSTABLE()....
Could anybody help me ??
Thanks,
marcus
| 0 |
11,734,196 | 07/31/2012 06:15:51 | 398,802 | 07/22/2010 07:05:37 | 134 | 3 | Where to start from to develop for tablets (ICS)? | I am familiar with android 2.2 and I have been developing for phones, now where to start from when developing for ICS tablets. The major thing I learned from quick-google that now I will have to use fragments for multi-pane layouts rather than mere Activity. What else do I need to look for before starting?
Some links would be helpful (for fragments too). | android | ice-cream-sandwich | null | null | null | null | open | Where to start from to develop for tablets (ICS)?
===
I am familiar with android 2.2 and I have been developing for phones, now where to start from when developing for ICS tablets. The major thing I learned from quick-google that now I will have to use fragments for multi-pane layouts rather than mere Activity. What else do I need to look for before starting?
Some links would be helpful (for fragments too). | 0 |
11,681,645 | 07/27/2012 04:52:51 | 239,610 | 12/07/2009 07:09:03 | 28 | 7 | Powerpoint Interop API access multiple slide masters inside slide master view | I have powerpoint presentation with multiple master slides.I want to access current active powerpoint presentation slide master in master view using InterOp API and VB.net. When I tried to access active slide master it always select the first slide master instead of active master slide.I tried it with slides and I could access current slide.But in slideMaster view I couldn't find way to access specified slide master.
ActivePresentation.Slides(2) 'this way I can access specified slide.
ActivePresentation.SlideMaster
| vb.net | interop | powerpoint-2007 | null | null | null | open | Powerpoint Interop API access multiple slide masters inside slide master view
===
I have powerpoint presentation with multiple master slides.I want to access current active powerpoint presentation slide master in master view using InterOp API and VB.net. When I tried to access active slide master it always select the first slide master instead of active master slide.I tried it with slides and I could access current slide.But in slideMaster view I couldn't find way to access specified slide master.
ActivePresentation.Slides(2) 'this way I can access specified slide.
ActivePresentation.SlideMaster
| 0 |
11,262,209 | 06/29/2012 12:56:50 | 908,389 | 08/23/2011 19:28:23 | 60 | 3 | C++ Redistributable package with WIX | So, I wrote a code which uses some Microsoft Sql server dlls, these dlls depends on some C++ libraries. Initially the code was not working on the client's machine but when I installed C++ Redistributable Package it worked fine.
My question is how can I install these dependencies along with my code. I am using WIX to install the software.
Thanks,
Ali | .net | visual-c++ | wix | null | null | null | open | C++ Redistributable package with WIX
===
So, I wrote a code which uses some Microsoft Sql server dlls, these dlls depends on some C++ libraries. Initially the code was not working on the client's machine but when I installed C++ Redistributable Package it worked fine.
My question is how can I install these dependencies along with my code. I am using WIX to install the software.
Thanks,
Ali | 0 |
11,262,215 | 06/29/2012 12:57:10 | 1,262,187 | 03/11/2012 11:36:54 | 1 | 0 | django gives an error in virtualenv | I do have win7 64 bit. Sequence of my action is below
1. I have installed python 2.7.3. system path is clear.
2. Then i did install virtualenv and pip
3. Next is sequence of mine command
+ cd c:\Users\developer\
+ mkdir .virtualenv
+ cd .virtualenv
+ virtualenv --distribute --no-site-packages djangos
+ cd djangos
+ cd script
+ activete.bat
+ pip install django
now i include into system path env a directory
<p><b>c:\Users\developer\.virtualenv\django\scripts</b></p>
here is the problem. if type in console
<p>cd c:\Project </p>
<p><b>django-admin.py startproject helloworld</b></p>
then i am getting<br />
Traceback (most recent call last):
File "C:\Users\developer\.virtualenv\djangos\Scripts\django-admin.py", line 2, in <module>
from django.core import management
ImportError: No module named django.core
but if i do run <br />
python<br />
and the inside interpreter
>>import django
>>django.VERSION
>>(1, 4, 0, 'final', 0)
>>from django import core
>>from django.core import managment
I dont receive any error
only way to create project it is to run <br />
<b>(djangos) c:\Projects>python c:\Users\developer\.virtualenv\djangos\Scripts\django-admin.py startproject hello</b>
if there is a way to avoid every time to type full path in cli?
| python | django | null | null | null | null | open | django gives an error in virtualenv
===
I do have win7 64 bit. Sequence of my action is below
1. I have installed python 2.7.3. system path is clear.
2. Then i did install virtualenv and pip
3. Next is sequence of mine command
+ cd c:\Users\developer\
+ mkdir .virtualenv
+ cd .virtualenv
+ virtualenv --distribute --no-site-packages djangos
+ cd djangos
+ cd script
+ activete.bat
+ pip install django
now i include into system path env a directory
<p><b>c:\Users\developer\.virtualenv\django\scripts</b></p>
here is the problem. if type in console
<p>cd c:\Project </p>
<p><b>django-admin.py startproject helloworld</b></p>
then i am getting<br />
Traceback (most recent call last):
File "C:\Users\developer\.virtualenv\djangos\Scripts\django-admin.py", line 2, in <module>
from django.core import management
ImportError: No module named django.core
but if i do run <br />
python<br />
and the inside interpreter
>>import django
>>django.VERSION
>>(1, 4, 0, 'final', 0)
>>from django import core
>>from django.core import managment
I dont receive any error
only way to create project it is to run <br />
<b>(djangos) c:\Projects>python c:\Users\developer\.virtualenv\djangos\Scripts\django-admin.py startproject hello</b>
if there is a way to avoid every time to type full path in cli?
| 0 |
11,262,219 | 06/29/2012 12:57:14 | 980,799 | 10/05/2011 16:42:13 | 8 | 0 | Getting application cache working for the iPad | I am unable to get to get the application cache running on the iPad ios 5. I have a site on our Intranet where, if I use Safari or Chrome, the cache manifest is read in, and the files are downloaded to the cache for offline use.
I have added this logging function to my page:
function logEvent(e) {
var online, status, type, message;
online = (navigator.onLine) ? 'yes' : 'no';
status = cacheStatusValues[cache.status];
type = e.type;
message = 'online: ' + online;
message += ', event: ' + type;
message += ', status: ' + status;
if (type == 'error' && navigator.onLine) {
message += ' (prolly a syntax error in manifest)';
}
console.log(message);
}
On the desktop browsers, I get the messages:
Application Cache Checking event
Application Cache NoUpdate event
online: yes, event: checking, status: idle /IM/:76
online: yes, event: noupdate, status: idle
However, with the iPad, the application cache is not being read in. It should be noted that the iPad needs to connect to the website via an alternate network due to corporate policy. The messages I get with the iPad are:
online: yes, event: checking, status: uncached
online: yes, event: error, status: uncached (prolly a syntax error)
We are using IIS to serve this site, and we added a MIME-type for .appcache to be served as text/cache-manifest. I did note in Fiddler from my desktop, when I requested the page, it returned:
# Result Protocol Host URL Body Caching Content-Type Process Comments Custom
5 401 HTTP 10.6.4.247 /IM/cache.appcache 1,539 text/html chrome:9976
Fiddler is saying it is being served as text/html, but the status code is 401 due to us being behind a proxy.
I have no idea how to debug this further, does anyone have any idea how I can troubleshoot this?
Thanks! | ipad | safari | browser-cache | offline-caching | offlineapps | null | open | Getting application cache working for the iPad
===
I am unable to get to get the application cache running on the iPad ios 5. I have a site on our Intranet where, if I use Safari or Chrome, the cache manifest is read in, and the files are downloaded to the cache for offline use.
I have added this logging function to my page:
function logEvent(e) {
var online, status, type, message;
online = (navigator.onLine) ? 'yes' : 'no';
status = cacheStatusValues[cache.status];
type = e.type;
message = 'online: ' + online;
message += ', event: ' + type;
message += ', status: ' + status;
if (type == 'error' && navigator.onLine) {
message += ' (prolly a syntax error in manifest)';
}
console.log(message);
}
On the desktop browsers, I get the messages:
Application Cache Checking event
Application Cache NoUpdate event
online: yes, event: checking, status: idle /IM/:76
online: yes, event: noupdate, status: idle
However, with the iPad, the application cache is not being read in. It should be noted that the iPad needs to connect to the website via an alternate network due to corporate policy. The messages I get with the iPad are:
online: yes, event: checking, status: uncached
online: yes, event: error, status: uncached (prolly a syntax error)
We are using IIS to serve this site, and we added a MIME-type for .appcache to be served as text/cache-manifest. I did note in Fiddler from my desktop, when I requested the page, it returned:
# Result Protocol Host URL Body Caching Content-Type Process Comments Custom
5 401 HTTP 10.6.4.247 /IM/cache.appcache 1,539 text/html chrome:9976
Fiddler is saying it is being served as text/html, but the status code is 401 due to us being behind a proxy.
I have no idea how to debug this further, does anyone have any idea how I can troubleshoot this?
Thanks! | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.