Id
int64 1.68k
75.6M
| PostTypeId
int64 1
2
| AcceptedAnswerId
int64 1.7k
75.6M
⌀ | ParentId
int64 1.68k
75.6M
⌀ | Score
int64 -60
3.16k
| ViewCount
int64 8
2.68M
⌀ | Body
stringlengths 1
41.1k
| Title
stringlengths 14
150
⌀ | ContentLicense
stringclasses 3
values | FavoriteCount
int64 0
1
⌀ | CreationDate
stringlengths 23
23
| LastActivityDate
stringlengths 23
23
| LastEditDate
stringlengths 23
23
⌀ | LastEditorUserId
int64 -1
21.3M
⌀ | OwnerUserId
int64 1
21.3M
⌀ | Tags
list |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6,517,373 | 1 | 6,558,217 | null | 1 | 1,068 |
I need to make the date parts (dd, MMMM, yyyy) to be vertically aligned. I asked a question at [Fixed length of month and day in date format?](https://stackoverflow.com/questions/6515371/fixed-length-of-month-and-day-in-date-format) to insert padding letters, but I found that it doesn't help in case of proportional font (the width of the letters are different). For example, with Lucida Fax font:

Making different labels for different date parts is considering but it's too manual. It's hard to make the text wrapped if the column width is small....
Thanks
|
Alignment date parts in JTable column formatted in propotional font
|
CC BY-SA 3.0
| null |
2011-06-29T07:52:12.363
|
2011-07-02T16:28:01.650
|
2017-05-23T11:58:11.067
| -1 | 658,741 |
[
"java",
"swing",
"jtable",
"date-format",
"tablecellrenderer"
] |
6,517,561 | 1 | 6,517,831 | null | 4 | 315 |
> I am new to iPhone development, please
suggest the right way to rectify the below problem.I am
displaying the Google Map as below :

> Now the problem is the Top Navigation
bar pushes the Google logo on Map
below screen and hence it is not
visible, when I hide the Navigation
bar, I can see the Google logo as
below

> Code Reference :
```
- (void)viewDidLoad
{
[super viewDidLoad];
[self.navigationController setNavigationBarHidden:YES animated:NO];
mapView.showsUserLocation=TRUE;
self.title =@"Map View";
mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];
mapView.showsUserLocation=TRUE;
mapView.mapType = MKMapTypeStandard;
mapView.delegate=self;
/*Region and Zoom*/
MKCoordinateRegion region;
MKCoordinateSpan span;
span.latitudeDelta = 0.2;
span.longitudeDelta = 0.2;
CLLocationCoordinate2D location=mapView.userLocation.coordinate;
AppDelegate *appdelegate=(AppDelegate *)[[UIApplication sharedApplication]delegate];
location.latitude = [appdelegate.RDLat doubleValue];
location.longitude = [appdelegate.RDLng doubleValue];
region.span=span;
region.center=location;
[mapView setRegion:region animated:TRUE];
[mapView regionThatFits:region];
ParkPlaceMark *placemark=[[ParkPlaceMark alloc] initWithCoordinate:location title:appdelegate.RestAddress];
[mapView addAnnotation:placemark];
[self.view insertSubview:mapView atIndex:0];
}
```
> Now Please suggest me how to show
Navigation bar without pushing the
Google map below.Any help highly appriciated
|
iPhone : Top Navigation bar push the Google logo down the screen
|
CC BY-SA 3.0
| 0 |
2011-06-29T08:12:42.657
|
2011-06-29T09:40:26.157
|
2011-06-29T08:18:02.960
| 28,557 | 28,557 |
[
"iphone",
"google-maps",
"dictionary"
] |
6,517,608 | 1 | 6,518,498 | null | 1 | 116 |
I just want to know if this is the proper way to go about splitting up widgets in GWT that get too large, or if I am missing the concept of widgets/proper GWT usage all together.
I started out with a single class (widget), . As became too large, I decided to branch off and make two classes , and , both of which just split off 's code into separate classes that still have access to the methods in :

This way, in my class, I can do something like this to add the and the to the tabs ([TabLayoutPanel](http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/user/client/ui/TabLayoutPanel.html)) that are specified in the UiBinder of while allowing for and to have their own separate UiBinder specifications:

My question is: Is this proper? Part of me thinks "no" just because it's not a nice way of doing it. On the other hand it works just fine, and my web application is somewhat broken up into manageable "sections" which is what I wanted.
Thanks for any insight.
|
Proper way to break apart a GWT widget into smaller chunks
|
CC BY-SA 3.0
| null |
2011-06-29T08:17:45.910
|
2011-06-29T09:32:29.047
|
2011-06-29T08:24:24.853
| 586,621 | 586,621 |
[
"gwt"
] |
6,518,009 | 1 | 6,518,303 | null | 1 | 1,252 |

Is there any way to hide progress bar which comes on top in navigation bar of MPMoviePlayerController?
I want to hide because I do not want user to forward/backward the video. However, User can exit it by clicking on DONE button.
|
want to hide progressbar which comes on top in navigation bar of MPMoviePlayerController
|
CC BY-SA 3.0
| 0 |
2011-06-29T08:53:05.563
|
2011-06-29T13:39:16.480
|
2011-06-29T13:39:16.480
| 813,769 | 813,769 |
[
"iphone",
"mpmovieplayercontroller",
"mpmoviewcontroller"
] |
6,518,078 | 1 | 6,518,619 | null | 2 | 350 |
I have an SSRS Report. In which I have a table that has some rows. I want to calculate some things on the basis of these rows. See the sample table and things to be calculated:

Employment Period is calculated using `if( DayEmployed>730) then add 1 to count.` and `count` is the count of `Employment Periods greater than 2 Years`. How can I calculate this in SSRS?
|
Calculations in SSRS
|
CC BY-SA 4.0
| null |
2011-06-29T09:00:40.717
|
2022-08-12T21:36:28.677
|
2022-08-12T21:36:28.677
| 472,495 | 669,448 |
[
"asp.net",
"reporting",
"reporting-services",
"formula"
] |
6,518,104 | 1 | 6,520,023 | null | 0 | 794 |
Is it possible to set the datefield in Extjs4 to be opend by default, to only have a small calendar with today date selected, to somehow skip clicking a datefield button to open a calendar and to hide a textfield in datefield??


|
Datefield modification Extjs4?
|
CC BY-SA 3.0
| null |
2011-06-29T09:02:01.310
|
2011-06-29T11:38:39.100
| null | null | 765,628 |
[
"extjs",
"calendar",
"extjs4",
"datefield"
] |
6,518,215 | 1 | 12,161,993 | null | 29 | 37,695 |
I'm intending to display very large Images in Android. - to supply them as pdf - fails because not every handheld got a pdf-viewer preinstalled, and I don't want to require the users to install one.
So I have a png now that I want to display. I downloaded this image to test how it would be displayed the gallery. It was quite painful. It seems that the galery renders this picture only once, and if I Zoom in, I cannot read the text at all.
So I wrote a testActivity which simply has an ImageView nested in a LinearLayout. I put the image into the drawable and set it as ImageView's image-source.
Unforunately the app crashes immediatly, due to an "
```
ERROR/AndroidRuntime(8906): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget"
```
I didn't expect that ONE single Image can be too large for`VM's memory`. I played a little bit around, set `ImageViews` size to `3998 & 2827px` , put the Image to `sdCard` and read it manually with a `fileInputStream`.
To my big surprise it now shows my image, but if I turn my I get the same `OutOfMemoryError` as before.
Can somewone point me the main difference between recieving a Bitmap through a `FileInputStream` or to set it as `ImageView's` source.
Also I'm not able to scroll comfortable with two parent `scrollViews`
I searching for a simple solution to display `ONE large image` at a time with the ability to `scroll horizontal and vertical` while able to zoom in and out.
here is a sample of the image I want to display

|
display huge Images in Android
|
CC BY-SA 3.0
| 0 |
2011-06-29T09:11:45.840
|
2015-05-25T13:45:41.263
|
2013-04-18T05:20:57.007
| 664,177 | 620,053 |
[
"android",
"image",
"memory",
"view",
"png"
] |
6,518,469 | 1 | 7,203,661 | null | 1 | 159 |
I've been developing a WPF interface for the past year, and this week I've noticed I can no longer open the interface within Visual Studio 2010 without it hanging indefinitely. I'm wondering why this has just started happening. I've checked through the SQL settings for the data bindings and everything seems fine. Does anyone know of any of other options I have? I can't seem to cancel this endless loading.

|
WPF Visual Preview hangs indefinitely
|
CC BY-SA 3.0
| 0 |
2011-06-29T09:30:26.447
|
2012-07-11T05:44:06.950
|
2011-06-29T14:40:52.560
| 546,730 | 271,200 |
[
"wpf",
"visual-studio-2010",
"data-binding",
"designer"
] |
6,518,566 | 1 | 6,521,116 | null | 0 | 576 |
I found this thread about my problem.
[Integrate TeamCity Reports to Confluence](https://stackoverflow.com/questions/1486369/integrate-teamcity-reports-to-confluence)
I followed exactly the instructions, but I always get the same error.
My Widget looks like that:

And when im click on it, I get this error:

|
How to Integrate Teamcity Reports to Confluence
|
CC BY-SA 3.0
| 0 |
2011-06-29T09:37:40.533
|
2011-06-29T13:06:55.260
|
2017-05-23T12:19:48.617
| -1 | 817,209 |
[
"teamcity",
"confluence"
] |
6,519,007 | 1 | null | null | 0 | 269 |
When reading codes, I often run into a metadata file like the marked-red as in the below snapshot.
For the same code, when debugging, Visual Studio IDE will ask to browse for the definition code of the `.dll` file. I browse to the source of that `dll` and can continue to debug with that pointed-out source.
What I need is: When browing the code (NOT when debugging), I am able to browse/be-asked-to-choose the source of that `metadata` dll source code when call `Go to definition` and/or `Pressing F12` - I don't want to paintfully start a debug to be able to see the code of the dll.
I don't know how to do that or is it possible. Please help!

|
How to browse definition of a method in a .dll when reading code the same way when debugging that code?
|
CC BY-SA 3.0
| null |
2011-06-29T10:15:29.343
|
2011-06-29T14:01:04.013
|
2011-06-29T14:01:04.013
| 248,616 | 248,616 |
[
"visual-studio",
"debugging",
"definition"
] |
6,519,030 | 1 | 6,526,898 | null | 1 | 617 |
I need to make a punch hole in Qt application so that I can see the video running behind Qt graphics.
My Qt application is using directfb api underneath.
Is there any way to do this?
Thanks,
KBalar

|
How to make punch hole in Qt Application
|
CC BY-SA 3.0
| 0 |
2011-06-29T10:17:37.023
|
2011-06-30T08:17:47.893
|
2011-06-30T08:17:47.893
| 202,635 | 202,635 |
[
"qt"
] |
6,519,169 | 1 | 6,521,402 | null | 0 | 1,067 |
this is my controller class:-
```
public class PlantHeadController : Controller
{
private WOMSEntities2 db = new WOMSEntities2();
//
// GET: /PlantHead/
Document doc = new Document();
static String[] tt=new String[20];
public ActionResult Index()
{
ViewBag.productCode = new SelectList(db.Product, "ID","code");
return View();
}
public void Convert()
{
PdfWriter.GetInstance(doc, new
FileStream((Request.PhysicalApplicationPath + "\\Receipt3.pdf"),
FileMode.Create));
doc.Open();
PdfPTable table = new PdfPTable(2);
doc.AddCreationDate();
PdfPCell cell = new PdfPCell(new Phrase("Receipt"));
cell.Colspan = 3;
cell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
table.AddCell(cell);
table.AddCell("ahym");
table.AddCell("ram";
table.AddCell("good");
table.AddCell("morning");
String rawGroup = "";
foreach (String lll in raw)
rawGroup = rawGroup + lll+" ";
table.AddCell("" + rawGroup);
doc.Add(table);
doc.Close();
Response.Redirect("~/Receipt3.pdf");
}
}
```
whenever i press submit button to make pdf file then this error window is opened:-

means pdf is not generated successfully. in some cases old pdf is shown. please suggest me what should i do?
|
error in generating pdf using iTextSharp
|
CC BY-SA 3.0
| 0 |
2011-06-29T10:29:14.337
|
2011-06-30T02:41:24.803
|
2011-06-29T10:32:01.183
| 219,406 | 887,872 |
[
"asp.net-mvc",
"itext"
] |
6,519,365 | 1 | null | null | 1 | 903 |
I am trying to create a snapshot in Xcode 4, and I keep on getting the error "This file does not exist in the index." and it says it can't create a snapshot. When I press ok, it has the progress bar for creating a snapshot and doesn't do anything else.

|
Xcode: Can't create snapshot - This file does not exist in the index
|
CC BY-SA 3.0
| null |
2011-06-29T10:42:06.983
|
2011-06-29T22:51:14.710
|
2011-06-29T22:51:14.710
| 163,845 | 163,845 |
[
"objective-c",
"xcode",
"ios4",
"xcode4"
] |
6,519,836 | 1 | 6,519,938 | null | 1 | 3,907 |
I am developing an application in which I have to show a filled arc on my circle which will indicate the selected time.
I have attached an image for specifying what I exactly want to ask:-

Please help me in how to draw arc on circle.
Any suggestions will be highly appreciated.
|
Draw an arc on circle
|
CC BY-SA 3.0
| null |
2011-06-29T11:23:31.527
|
2011-06-29T11:31:15.923
| null | null | 633,676 |
[
"iphone",
"objective-c",
"core-graphics"
] |
6,519,824 | 1 | null | null | 0 | 1,298 |
before reading my problem this work in a normal dynamic web project
i create a web service like this methode:
[http://www.youtube.com/watch?v=o2Vjs8ylmFM](http://www.youtube.com/watch?v=o2Vjs8ylmFM)
using CFX 2.4 and with the 2.5 dynamic web model version and when i run hibernate in this current client web project generated by the web service i get an exception
this is it:
```
Etat HTTP 500 -
--------------------------------------------------------------------------------
type Rapport d''exception
message
description Le serveur a rencontré une erreur interne () qui l'a empêché de satisfaire la requête.
exception
org.apache.jasper.JasperException: Impossible de compiler la classe pour la JSP:
An error occurred at line: 1 in the generated java file
The type net.sf.hibernate.Session cannot be resolved. It is indirectly referenced from required .class files
Une erreur s'est produite à la ligne: 16 dans le fichier jsp: /JSP/ebook/index.jsp
Session cannot be resolved to a type
13: <BODY>
14: <%
15:
16: Session hibernateSession = HibernateUtil.currentSession();
17: Transaction tx = hibernateSession.beginTransaction();
18:
19: Etudinat etudiant = new Etudinat();
Une erreur s'est produite à la ligne: 16 dans le fichier jsp: /JSP/ebook/index.jsp
```
and my class hibernateUtil is :
```
package DBase;
import net.sf.hibernate.*;
import net.sf.hibernate.cfg.*;
public class HibernateUtil {
private static final SessionFactory sessionFactory;
static {
try {
// Crée la SessionFactory
sessionFactory =
new Configuration().configure().buildSessionFactory();
} catch (HibernateException ex) {
throw new RuntimeException("Problème de configuration : "
+ ex.getMessage(), ex);
}
}
public static final ThreadLocal session = new ThreadLocal();
public static Session currentSession()
throws HibernateException {
Session s = (Session) session.get();
// Ouvre une nouvelle Session, si ce Thread n'en a aucune
if (s == null) {
s = sessionFactory.openSession();
session.set(s);
}
return s;
}
```
and my hibernate.cfg.xml page is:
```
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory >
<!-- local connection properties -->
<property name="hibernate.connection.url">jdbc:mysql://localhost/ebook</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">162826</property>
<!-- property name="hibernate.connection.pool_size"></property -->
<!-- dialect for MySQL -->
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<property name="current_session_context_class">thread</property>
<mapping resource="DBase/Favorieensei.hbm" />
<mapping resource="DBase/Ajouter.hbm" />
<mapping resource="DBase/Favorie.hbm" />
<mapping resource="DBase/Enseignant.hbm" />
```
and this is my page jsp
```
<%@page import="DBase.HibernateUtil"%>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%@ page import="DBase.*" %>
<%@ page import="net.sf.hibernate.*" %>
<%@ page import="net.sf.hibernate.cfg.*" %>
<HTML>
<HEAD>
<title>Greetings!</title>
</HEAD>
<BODY>
<%
Session hibernateSession = HibernateUtil.currentSession();
Transaction tx = hibernateSession.beginTransaction();
Etudinat etudiant = new Etudinat();
etudiant.setUserName("davido");
etudiant.setPassword("mioo");
etudiant.setQuestion("best music");
etudiant.setAnswer("rock");
etudiant.setEmail("[email protected]");
etudiant.setNom(".....");
etudiant.setPrenom("....");
etudiant.setSexe("Homme");
etudiant.setIDFilliere(Filliere.INFORMATIQUE);
hibernateSession.save(etudiant);
tx.commit();
HibernateUtil.closeSession();
%>
<br>
<br>
<br>
<br>
<table width="400" border="0" cellspacing="1" cellpadding="0" align="center" class="tableBox">
<tr>
<td CLASS="bluebanner" align="center"> Greetings, </TD>
</tr>
</table>
</BODY>
</HTML>
```
plz help us we are running on time i have 3 left to finish it
|
problem hibernate in web service
|
CC BY-SA 3.0
| 0 |
2011-06-29T11:22:48.210
|
2011-06-29T15:25:20.863
|
2011-06-29T15:25:20.863
| 742,132 | 742,132 |
[
"eclipse",
"web-services",
"hibernate",
"jsp",
"exception"
] |
6,519,879 | 1 | 6,523,411 | null | 2 | 1,775 |
I do this query with NHibernate:
```
var test = _session.CreateCriteria(typeof(Estimation))
.SetFetchMode("EstimationItems", FetchMode.Eager)
.List();
```
An "Estimation" can have several "EstimationItems" (Quantity, Price and ProductId)
I'd like a list of "Estimation" with these constraints :
1. One line by "Estimation" code on the picture (ex : 2011/0001 and 2011/0003)
2. By estimation (means on each line) the number of "EstimationItems"
3. By Estimation (means on each line) the total price (Quantity * Price) for each "EstimationItems"
I hope the structure will be clearer with the picture below.
Thanks,


|
Linq Aggregate on object and List
|
CC BY-SA 3.0
| null |
2011-06-29T11:26:37.817
|
2011-06-30T07:36:13.210
| null | null | 118,584 |
[
"c#",
"linq",
"nhibernate"
] |
6,520,063 | 1 | 6,520,179 | null | 0 | 27 |
In my web applications i have to generate seven different type of forms. There is a big 7 level tree and from that each first level subnode is a separate form. So for this what i am thinking is to generate 7 different xml files and to display the form like below given image i will parse the particular xml and display it. In my xml there will be node id and for each user i will store his selected nodes in the table so that i can retrieve later in my account section.
My question now are: is this xml approach proper...? and what kind of xml should i generated so that maximum flexibility can be kept in xml.. eg if i keep attribute validation: required in any node than it becomes required field in the generated html. i have to make a parser for that.

|
project design problem
|
CC BY-SA 3.0
| null |
2011-06-29T11:41:16.477
|
2011-06-29T11:51:03.900
| null | null | 349,687 |
[
"xml",
"database-design",
"treeview"
] |
6,520,154 | 1 | 6,527,891 | null | 2 | 937 |
i have some uibezierpaths. as paths, they don't really have thickness.
but, I am hoping to find a way to define an area around a path like the grayish areas around the lines in this picture
basically, i want to test whether drawn lines fall within the buffer zone around the lines.
i thought this would be simple, but it's turning out to be much more complex than i thought. I can use the CGPathApply function to examine the points along my path, and then getting a range +or- each point, but it's more complicated than that with angles and curves. any ideas?
|
how to get buffer zone around a uibezierpath
|
CC BY-SA 3.0
| null |
2011-06-29T11:48:36.907
|
2011-11-01T17:36:03.627
| null | null | 802,418 |
[
"ios",
"nsbezierpath",
"uibezierpath",
"bounding"
] |
6,520,473 | 1 | 6,547,156 | null | 2 | 810 |
We developed our own JCA-provider. We installed it and registered using "Static Registration" procedure (as described in ["Installing Providers"](http://download.oracle.com/javase/6/docs/technotes/guides/security/crypto/CryptoSpec.html#ProviderInstalling)). But when the Java stared automatic update process he failed with following error:

Does anybody know what happened and how we need to install/register our JCA-provider to prevent such an error?
After this warning Java update fails and . JRE return the following error:

|
"Java Cryptography Architecture (JCA) provider" and "Java update" issue
|
CC BY-SA 3.0
| 0 |
2011-06-29T12:15:21.180
|
2011-09-17T09:21:41.313
|
2011-09-17T09:21:41.313
| 947,357 | 197,897 |
[
"java",
"cryptography"
] |
6,520,485 | 1 | 6,520,798 | null | 6 | 3,315 |
Since we've converted all our source and header files to unicode, we're facing problems with german umlauts. Everything is fine in the source but QLabels and other gui components are showing umlauts garbled.
ISO-8859-1 source works fine but causes problems when switching between OSX and Windows.
Is there anything I have to set in the project file?
Environment: Qt 4.7 with Qt Creator 2.3.0 using MinGW on Windows XP SP3

|
Qt unicode and umlauts
|
CC BY-SA 3.0
| 0 |
2011-06-29T12:16:19.717
|
2015-01-12T10:48:55.270
| null | null | 366,299 |
[
"qt",
"unicode",
"internationalization",
"diacritics"
] |
6,520,908 | 1 | null | null | 3 | 509 |

I am implementing a custom progress bar using a timer and the Quartz2d draw circle/fill circle functions. Basically, I am using `CGContextAddLines,CGContextAddArc,CGContextDrawPath` methods but with limited success.
My Progress bar is implemented as a circle with a black background. Activity in the progress bar is implemented as an internal, incrementing segment of purple color. The segment is drawn in increments from -90 degrees (as shown in the image) and finishing at 360 degree. Ten seconds after the progress activity completes I am trying to change the fill color of the circle back to black.
My problem is that even though I can completely fill the color with purple, I am having trouble resetting the black background of the circle after 10 seconds. Any help would be appreciated.
|
fill circle with change color after few second
|
CC BY-SA 3.0
| null |
2011-06-29T12:51:13.577
|
2011-07-27T21:51:13.830
|
2011-07-21T04:35:48.317
| 34,820 | 602,997 |
[
"iphone",
"objective-c",
"ios4",
"quartz-graphics"
] |
6,521,089 | 1 | null | null | 4 | 2,018 |
I have written a app in WPF. And I am using standard BlueTheme available on microsoft website for my application. The application looks great in Windows XP which is having Windows XP style. In the screenshot below we can see the buttons with round edges and evrything.

I then right clciked on my desktop and went to appearance and chose windows classic style. Then the application looks crap. All the buttons are now having square edges.

I think searched in internet and people had suggested to include PresentationFramework.Aero theme. But still the problem persists.
[Edits]
I have added the below line. Still it doesn't work !
```
<Window.Resources>
<ResourceDictionary Source="/PresentationFramework.Aero, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml" />
</Window.Resources>
```
|
How to make a WPF application the same in both Windows classic style and windows XP style?
|
CC BY-SA 3.0
| 0 |
2011-06-29T13:04:55.240
|
2011-06-30T06:38:07.093
|
2011-06-30T06:38:07.093
| 443,568 | 443,568 |
[
"wpf",
"windows-xp",
"themes",
"appearance"
] |
6,521,113 | 1 | 6,521,226 | null | 7 | 3,994 |
In Swing, I'm trying to use a `BoxLayout` or equivalent linear container, but the items in the container are stretching vertically. Inside my application, I don't want them to stretch vertically.
I know i could set a preferredSize or maximumSize on components, but the following code is just a reproducer, and I can't hard-code or maximize the size of the components, which are in reallity more complex and . And I just can't use a `BorderLayout` with the `BorderLayout.TOP` position, because no scroll bars will ever show if I do that. And I might need scroll panes.
---
So I tried to use the `fillers` in a `BoxLayout` as explained in [Using Invisible Components as Filler](http://download.oracle.com/javase/tutorial/uiswing/layout/box.html#filler), but it just doesn't work. Although in the Oracle documentation, it seemed to be exactly what I needed. Here are my attempts:
```
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
public class TestBoxLayout implements Runnable {
public static void main(String[] args) {
SwingUtilities.invokeLater(new TestBoxLayout());
}
@Override
public void run() {
JFrame f = new JFrame("test box layout");
JPanel b = new JPanel();
b.setLayout(new BoxLayout(b, BoxLayout.PAGE_AXIS));
b.add(new JTextField("field 1"));
b.add(new JTextField("field 2"));
b.add(new JTextField("field 3"));
b.add(Box.createVerticalGlue());
f.setContentPane(b);
f.setSize(500, 200);
f.setVisible(true);
}
}
```
This is the result I get:

---
I tried to use the [Box](http://download.oracle.com/javase/6/docs/api/javax/swing/Box.html#Box%28int%29) class instead of `JPanel` with `BoxLayout`, but the visual result is exactly the same. Here is my second try:
```
import javax.swing.Box;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
public class TestBox implements Runnable {
public static void main(String[] args) {
SwingUtilities.invokeLater(new TestBox());
}
@Override
public void run() {
JFrame f = new JFrame("test box");
Box b = Box.createVerticalBox();
b.add(new JTextField("field 1"));
b.add(new JTextField("field 2"));
b.add(new JTextField("field 3"));
b.add(Box.createVerticalGlue());
f.setContentPane(b);
f.setSize(500, 200);
f.setVisible(true);
}
}
```
---
Does anyone know how I can and make them work ? A fix on the given code would be fantastic.
This is a drawing I made using paint, which shows what I'd like to have as a result:

|
Swing BoxLayout problem - Can't make the Fillers do their job
|
CC BY-SA 3.0
| null |
2011-06-29T13:06:31.957
|
2014-09-04T04:09:04.763
| null | null | 673,726 |
[
"java",
"swing",
"layout",
"boxlayout"
] |
6,521,235 | 1 | null | null | 5 | 2,813 |
I've been trying to find what is the TrueType font behind Java's logical Monospaced font
on a Windows XP system.
The reason is that I use this font as my code editor's default font in IntelliJ Idea 10
on Windows XP and I recently moved to an Ubuntu system and want the same font in
Intellij Idea.
Currently on Ubuntu I get Courier New as the TrueType of Monospaced, and it is clearly
not the same font as the one used on Windows XP.
Could you please help ?
Thank you.
To be clear, I'm trying to have the Monospaced 12pt WinXP look the same on Ubuntu.
As you can see, the Monospaced 12pt WinXP isn't like any of the other versions.
Follow link for image of the different font appearance:

|
What is the TrueType font of java's logical font Monospaced on Windows XP
|
CC BY-SA 3.0
| 0 |
2011-06-29T13:15:51.570
|
2011-06-29T19:33:04.340
|
2011-06-29T17:48:15.913
| 104,891 | 703,888 |
[
"java",
"ubuntu",
"fonts",
"intellij-idea",
"truetype"
] |
6,521,303 | 1 | 6,522,028 | null | 0 | 449 |
I have created a tab in my app. Now the thing is that when I set the background color of my tab to white it's working but only grey color underline still appears so can anyone tell me how can I remove that line?
I am sending my code and snapshot of where the underline arise.
```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="horizontal"
android:background="#FFFFFF">
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dp">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp"/>
</LinearLayout>
</TabHost>
</LinearLayout>
```
```
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Resources res = getResources();
TabHost MainTabHost = getTabHost();
TabHost.TabSpec spec;
Intent intent;
intent = new Intent().setClass(this, ContactListForm.class);
spec = MainTabHost.newTabSpec("Contacts").setIndicator("Contacts",
res.getDrawable(R.drawable.ic_tab_artists))
.setContent(intent);
MainTabHost.addTab(spec);
intent = new Intent().setClass(this, CallDialerForm.class);
spec = MainTabHost.newTabSpec("Call").setIndicator("Call",
res.getDrawable(R.drawable.ic_tab_artists))
.setContent(intent);
MainTabHost.addTab(spec);
intent = new Intent().setClass(this, MyInfoForm.class);
spec = MainTabHost.newTabSpec("My Info").setIndicator("MyInfo",
res.getDrawable(R.drawable.ic_tab_artists))
.setContent(intent);
MainTabHost.addTab(spec);
MainTabHost.setCurrentTab(0);
for (int j = 0; j < MainTabHost.getTabWidget().getChildCount(); j++)
{
MainTabHost.getTabWidget().getChildAt(j).setBackgroundColor(Color.parseColor("#FFFFFF"));
}
}
```
Snapshot:

|
Underline in tabs while setting background
|
CC BY-SA 4.0
| null |
2011-06-29T13:20:31.600
|
2020-06-19T11:43:32.953
|
2020-06-19T11:43:32.953
| 13,363,205 | 806,106 |
[
"android"
] |
6,521,400 | 1 | null | null | 0 | 40 |
Having been struggling trying to bulkload data to the datastore, I have reached the point where expert help is needed.
I don't think what is am doing is tricky, I have the following configuration file:

and when I use the appcfg.py command, the error messages end with:
```
File "config.txt", line 1
python_preamble:
^
Syntax error: invalid syntax.
```
I have used a .txt file as it is faster to edit in notepad initially - I don't know if that is a problem and the remote_api for the appspot all seems to be okay.
I am thinking it is a fairly fundemental problem as it has stopped working at the top line. I removed the comment lines at the top of the original file - maybe that caused it.
I have tried to find working examples to set me right but they all seem to follow the syntax above, or where they are slightly different, I have tried both variants.
Help on bulkloading for my first cloud app would be much appreciated.
Thanks in advance for anyone taking time to read my post whether they solve it or not.
|
Bulkloader syntax Error
|
CC BY-SA 3.0
| null |
2011-06-29T13:26:38.527
|
2016-01-20T14:20:04.613
|
2016-01-20T14:20:04.613
| 4,370,109 | 816,980 |
[
"formatting",
"load",
"syntax-error",
"bulkloader"
] |
6,521,507 | 1 | 6,524,644 | null | 2 | 4,723 |
I have a text field with a set height and width and that allows word wrapping. When I add text to it, I dynamically change the font size until the height of the text is smaller than the height of the box, allowing it to properly fit. The problem I am running into is that the box is fairly thin by necessity, and some longer words (like "Australia") are broken during the word wrap. So, perhaps "Australi" will show up on the first line, and "a" on the second line. However, because they satisfy the height requirement, they aren't shrunk any more. I need a way to detect this and continue shrinking these cases so they fit without the break. Here is the code for dynamically shrinking the text to fit the height:
```
text.wordWrap = true;
text.autoSize = TextFieldAutoSize.CENTER;
while(text.height > textBoxVal) {
myFormat.size = Number(myFormat.size) - 2;
text.defaultTextFormat = myFormat;
text.setTextFormat(myFormat);
}
```
This works fine. The problem with my approach to the next step (shrinking if horizontal constraints are not met because of a word being split) is that by leaving `text.wordWrap` set to true, the longer words will still break and never be resized, but setting it to false means that the other boxes that were fine before because of word wrap being on (like "United States") are now too long on a single line, and are shrunk when they shouldn't be. For what it's worth, here's my code to shrink horizontally (immediately follows above code):
```
text.wordWrap = false;
text.autoSize = TextFieldAutoSize.LEFT;
while(text.width > textBoxVal) {
myFormat.size = Number(myFormat.size) - 2;
text.defaultTextFormat = myFormat;
text.setTextFormat(myFormat);
}
```
Is there a better way to go about this? Perhaps some way to force ActionScript not to break words, etc?
To give an example, please look at the screenshot below:

This is using only the first code block, which ensures that the text fits into the box's vertical constraints. You can see that some boxes (like the first for the US) are fine, whereas some of the smaller ones (like the last few) are split. Using my second code block to resize the horizontal constraints makes no changes if word wrap is true, and will make all boxes (including ones that are fine, like the US) smaller than needed if word wrap is set to false.
|
ActionScript's WordWrap Breaks Words
|
CC BY-SA 3.0
| null |
2011-06-29T13:36:04.707
|
2011-06-30T07:06:44.500
|
2011-06-29T18:57:33.053
| 290,136 | 290,136 |
[
"flash",
"actionscript-3",
"actionscript",
"word-wrap"
] |
6,521,534 | 1 | 6,547,987 | null | 0 | 919 |
I have created a tab based app, in one of the tab, there is also inner tab where some data is displayed in tabular format using adapter. It is perfectly ok in all devices with Android 2.1. But in all the devices with Android 2.2 devices, it is just showing only first tab only with black screen above. I have given two different screenshot for the reference.


```
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/myinfotrackerlayout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"/>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:gravity="bottom"
android:isScrollContainer="false"
android:scrollbarAlwaysDrawHorizontalTrack="false"
android:scrollbarAlwaysDrawVerticalTrack="false"
android:scrollbars="none"
android:background="#FFFFFF"/>
</LinearLayout>
</TabHost>
```
```
public class MyInfoTracker extends TabActivity {
private int tabid = 0;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.myinfotracker);
try{
final TabHost innerTabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab
Intent myint = this.getIntent();
tabid = myint.getIntExtra("tab_id", 0);
// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent().setClass(this, MyinfoActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP );
intent.putExtra("addType","CD4");
// Initialize a TabSpec for each tab and add it to the TabHost
spec = innerTabHost.newTabSpec("CD4Count").setIndicator("CD4 Count").setContent(intent);
innerTabHost.addTab(spec);
// Do the same for the other tabs
intent = new Intent().setClass(this, MyinfoActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP );
intent.putExtra("addType","VL");
spec = innerTabHost.newTabSpec("ViralLoad").setIndicator("Viral Load").setContent(intent);
innerTabHost.addTab(spec);
// Do the same for the other tabs
intent = new Intent().setClass(this, MyinfoActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP );
intent.putExtra("addType","Wt");
spec = innerTabHost.newTabSpec("Weight").setIndicator("Weight").setContent(intent);
innerTabHost.addTab(spec);
innerTabHost.setScrollbarFadingEnabled(false);
innerTabHost.setScrollContainer(false);
innerTabHost.setCurrentTab(tabid);
}catch(Exception e){}
}
}
```
What may cause this type of problem?
|
Tab layout issue in Froyo
|
CC BY-SA 3.0
| null |
2011-06-29T13:37:59.743
|
2012-05-22T08:27:08.773
|
2012-05-22T08:27:08.773
| 995,926 | 525,004 |
[
"android",
"layout",
"android-2.2-froyo",
"android-2.0-eclair"
] |
6,521,954 | 1 | 6,521,996 | null | 0 | 987 |
Below is the background image I am working with. (it's just cropped this way so you guys can see)

I need this to cover the whole page of the site I am building. How should I implement this? Make it much darker and go with transparent pngs?
|
Noise background, how can I implement this?
|
CC BY-SA 3.0
| null |
2011-06-29T14:06:13.247
|
2011-06-29T14:08:19.850
|
2011-06-29T14:06:53.423
| 23,199 | 133,059 |
[
"html",
"css",
"image",
"background"
] |
6,522,121 | 1 | 6,524,872 | null | 7 | 1,325 |
I'm having a weird problem with fb sdk for iphone.
It was working all fine till yesterday. I started getting an empty fb dialog when trying to post to wall. If I click Publish, it publishes fine, but the preview is not visible!
Tried uninstalling the app, also reauthorizing in fb and nothing...
Any idea?

|
facebook post to wall dialog is empty
|
CC BY-SA 3.0
| 0 |
2011-06-29T14:15:24.937
|
2011-06-30T10:15:27.863
|
2020-06-20T09:12:55.060
| -1 | 333,533 |
[
"iphone",
"facebook"
] |
6,522,445 | 1 | 6,522,618 | null | 0 | 3,884 |
Can anyone tell me how the best way to create this menu popup with the below images?

The next image shows what it should look like when you hover over the more link.
I have the popup menu as an image.

```
<script type="text/javascript">
$(function() {
$(this).find('#more_ddown').hide();
});
$(function() {
$('#v3NavHeaderLink3').hover(function(){
$('#more_ddown').fadeIn('fast');
}, function(){
$('#more_ddown').hide();
});
});
</script>
<nav id="NavHeader">
<a href="#" title="" id="Link1">Link #1</a>
<a href="#" title="" id="Link2">Link #2</a>
<a href="#" title="" id="Link3">More</a>
<img src="img/more.png" id="more_ddown" alt="alt" />
</nav>
```
|
Creating a JQuery menu popup
|
CC BY-SA 3.0
| 0 |
2011-06-29T14:35:16.783
|
2011-06-29T15:31:46.593
|
2011-06-29T14:48:11.020
| 543,282 | 543,282 |
[
"jquery",
"css"
] |
6,522,455 | 1 | 6,661,124 | null | 7 | 3,405 |
I have an XNA 4.0 project that I would like to be compiled with the .Net 4.0 Full profile, but it is set to Client profile by default. The combobox in the Application tab is grayed out.
I have uninstalled and reinstalled .Net 3.5, .Net 4.0 and Xna 4.0. What could be the problem? Our other development machines do not have this problem.

|
Unable to select Target framework for XNA 4.0 games
|
CC BY-SA 3.0
| 0 |
2011-06-29T14:35:59.500
|
2015-11-13T13:15:02.337
| null | null | 62,857 |
[
".net",
"visual-studio-2010",
"xna-4.0"
] |
6,522,450 | 1 | null | null | 0 | 263 |
One of my Android projects requires `oauth.signpost` artifact, so I have something like this in my `pom.xml`:
```
...
<dependency>
<groupId>oauth.signpost</groupId>
<artifactId>signpost-core</artifactId>
<version>1.2.1.1</version>
<scope>compile</scope>
</dependency>
...
```
The problem is that this depends on more artifacts, for instance: `org.apache.httpcomponents:httpclient:4.0.1`. The problem is that Android already provides that package and thus it makes my building process crash.
So, what I usually do is going to the dependencies configuration on IntelliJ and manually mark those redundant artifacts as instead of :

This process is annoying, not only because I have a lot of Maven dependencies, but also because sometimes IntelliJ what dependencies were market as and it will mark'em all as .
The only solution I see is to specify, in the `pom.xml`, which dependencies are and which are . But there are a lot of them, so it would take some time (also, I'd have to manually check which version is needed for each artifact, etc.).
So, is it a way to tell Maven to mark sub-dependencies as , while keeping main dependencies as ?
|
How to mark main dependency as "compile" and sub-dependencies as "provide"?
|
CC BY-SA 3.0
| null |
2011-06-29T14:35:42.027
|
2011-06-29T14:49:20.027
| null | null | 244,296 |
[
"java",
"maven",
"intellij-idea"
] |
6,522,640 | 1 | 6,529,467 | null | 0 | 126 |
I'd like to display the data from the array in the order as shown in the picture:

|
How to display data from two model in one view the given way in cakephp 1.3?
|
CC BY-SA 3.0
| null |
2011-06-29T14:50:08.707
|
2012-12-19T01:39:22.777
|
2012-12-19T01:39:22.777
| 367,456 | 217,681 |
[
"php",
"cakephp-1.3"
] |
6,522,704 | 1 | 6,522,901 | null | 9 | 3,724 |
The references (GOF Design Patterns, Head First Design Patterns, [http://www.dofactory.com/Patterns/PatternObserver.aspx](http://www.dofactory.com/Patterns/PatternObserver.aspx)) that I've read regarding the observer design pattern stipulate that the concrete subject holds a reference to the concrete observer. Much like this:
```
class ConcreteObserver : IObserver
{
ConcreteSubject concreteSubjectInstance;
//other code, etc.
}
```
Now, if the concrete Subject is itself implements a Subject interface (or derives from some abstract Subject class) why not make the type in the ConcreteObserver be of that abstract/interface? I.e.
```
class ConcreteObserver : IObserver
{
ISubject concreteSubjectInstance;
//other code, etc.
}
```
Moreover, why not just make it a field in the (e.g.) `IObserver` interface?
Ultimately, given that the pattern itself seems to loosen the coupling of the Subject to its Observers, why does this appear not to be promoted when coupling an Observer to its subject?

Or is it? I am only basing this on examples that I have read.
|
Observer Design Pattern - Concrete Subjects and Observers
|
CC BY-SA 3.0
| 0 |
2011-06-29T14:54:50.003
|
2021-10-22T02:32:35.183
|
2011-06-29T15:01:00.150
| 144,491 | 144,491 |
[
"design-patterns",
"observer-pattern"
] |
6,522,752 | 1 | 7,143,940 | null | 0 | 992 |
I want to replicate Gowalla UI of the detail part (the table with Map & Directions) picture below

I replicate it with a table with a contentInset, set backgroundColor to clearColor, and change color of UITableViewCell in `- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath` to white, but the result
isn't what I expected the empty cells are white only the cells with content (a number return by `- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section` ) here is a result I got

Is there any way to set empty cell color or any guide on how to achieve this ?
|
How to set color in empty UITableViewCell?
|
CC BY-SA 3.0
| null |
2011-06-29T14:58:05.870
|
2011-08-22T06:42:54.423
| null | null | 147,564 |
[
"ios",
"uitableview"
] |
6,522,779 | 1 | 6,524,770 | null | 2 | 334 |
I added Parent Settings File to the solutions folder. After that I unchecked there rule SA1101 in the parent file. Also I set "Do not merge with any file" in parent file, and set merge in the parent file in the project`s settings file.
But after I build project I get this error. I attached window with error and settings winwows - there are no overloads or something like this.

I really don`t now what I can do, to resolve this issue....
ADDED.
But in resharper all rules work normal. But when I try to build solutions - my settings are ignored.
I used StyleCop Version 4.5.24.0
|
Style Cop rules don't work
|
CC BY-SA 3.0
| 0 |
2011-06-29T14:59:44.320
|
2011-06-29T17:25:54.803
|
2011-06-29T16:08:26.097
| 525,278 | 525,278 |
[
"visual-studio-2010",
"resharper",
"stylecop"
] |
6,522,810 | 1 | null | null | 0 | 910 |
I've created a in ; when creating the application I selected iPhone as the :

The application was created with the following files:

I designed the UI on the file and without adding any code in the files, the application is uploading immediately to the view and I'm very happy about it.
Now I want to add an . How do I do that?
(I knew how to do it in XCode 3, but I used some code in the Delegate file, and now if I try to use the same code it doesn't work because the template default implementation works differently - Apple uses and s and it goes directly to the iPhone.xib. I don't know how to go around it without changing the entire thing to the way it was done in XCode3)
|
Adding iPad XIB to a View Based Application Template Application in XCode 4
|
CC BY-SA 3.0
| null |
2011-06-29T15:01:54.867
|
2011-06-29T18:07:17.593
| null | null | 1,143,060 |
[
"iphone",
"ipad",
"view",
"xcode4",
"xib"
] |
6,522,832 | 1 | null | null | 2 | 296 |
i have a html page which has a table and whose header is not same when printed as is displayed
the green div tag and table footer text is just printed with no background
please help me
my code is
```
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<style type="text/css">
.cnt
{
padding-top:10px;
padding-bottom:10px;
}
</style>
</head>
<body>
<div style="width:21cm; margin-left:auto; margin-right:auto; padding-top:0px; position:relative;">
<div style="width:90%; margin-left:auto; margin-right:auto;">
<div style="color:#FFF; background-color:green; padding:5px; font:20px bolder Verdana, Geneva, sans-serif; text-align:center;">
Receipt Details
</div>
<div>
<table border="1" cellspacing="2" cellpadding="2" width="100%">
<tbody><tr bgcolor="#000" style="color:#FFF; text-align:center;">
<td>
Receipt No.
</td>
<td>
Date
</td>
<td>
Amount Paid
</td>
<td>
Amount Due
</td>
<td>
Remark
</td>
</tr>
<tr style="text-align:center;">
<td>
</td>
<td>
</td>
<td>
500/-
</td>
<td>
</td>
<td>
Registration
</td>
</tr>
<tr style="text-align:center;">
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
Fee Payment
</td>
</tr>
<tr style="text-align:center;">
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
Fee Payment
</td>
</tr>
<tr style="text-align:center;">
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
Fee Payment
</td>
</tr>
</tbody></table>
</div>
</div>
</div>
</body></html>
```

|
HTML page id not printed same as being displayed
|
CC BY-SA 3.0
| null |
2011-06-29T15:02:56.380
|
2011-06-29T15:14:14.657
|
2011-06-29T15:14:14.657
| 261,194 | 821,373 |
[
"html",
"css",
"printing"
] |
6,522,869 | 1 | 6,523,010 | null | 9 | 18,959 |
I am trying to interface an ancient network camera to my computer and I am stuck at a very fundamental problem -- detecting the end of stream.
I am using `TcpClient` to communicate with the camera and I can actually see it transmitting the command data, no problems here.
```
List<int> incoming = new List<int>();
TcpClient clientSocket = new TcpClient();
clientSocket.Connect(txtHost.Text, Int32.Parse(txtPort.Text));
NetworkStream serverStream = clientSocket.GetStream();
serverStream.Flush();
byte[] command = System.Text.Encoding.ASCII.GetBytes("i640*480M");
serverStream.Write(command, 0, command.Length);
```
Reading back the response is where the problem begins though. I initially thought something simple like the following bit of code would have worked:
```
while (serverStream.DataAvailable)
{
incoming.Add(serverStream.ReadByte());
}
```
But it didn't, so I had a go another version this time utilising ReadByte(). The description states:
> Reads a byte from the stream and
advances the position within the
stream by one byte, or returns -1 if
at the end of the stream.
so I thought I could implement something along the lines of:
```
Boolean run = true;
int rec;
while (run)
{
rec = serverStream.ReadByte();
if (rec == -1)
{
run = false;
//b = (byte)'X';
}
else
{
incoming.Add(rec);
}
}
```
Nope, still doesn't work. I can actually see data coming in and after a certain point (which is not always the same, otherwise I could have simply read that many bytes every time) I start getting `0` as the value for the rest of the elements and it doesn't halt until I manually stop the execution. Here's what it looks like:

So my question is, am I missing something fundamental here? How can I detect the end of the stream?
Many thanks,
H.
|
C# - TcpClient - Detecting end of stream?
|
CC BY-SA 3.0
| 0 |
2011-06-29T15:05:01.873
|
2016-04-15T13:38:56.133
| null | null | 282,733 |
[
"c#",
"sockets",
"tcpclient",
"networkstream"
] |
6,522,911 | 1 | 6,523,227 | null | 2 | 236 |

I need to write a script in VBA so that if column B has a x (or just is filled) then goto the cell to the left of it and get the value, I want to do this on a worksheet and I want to be able to calculate the total cost of a project depending if its required.
I would run this on event of a button click, so I want it to get all the values, add them up, and display me the total, But ONLY for the values with a x (in column B).
|
Simple Script in VBA to get values from flagged cells, add them and display the total
|
CC BY-SA 3.0
| null |
2011-06-29T15:07:55.600
|
2011-06-29T15:33:11.813
|
2011-06-29T15:33:11.813
| 13,295 | 711,308 |
[
"excel",
"vba",
"worksheet-function"
] |
6,523,075 | 1 | null | null | 12 | 20,313 |
I am trying to run my .NET 3.5 WinForms application on a Win7 x64. The application uses NHibernate and the System.Data.OracleClient to access an Oracle database. The Oracle client is 32bit.
When starting up the app I get the following error message
> Attempt to load Oracle client libraries threw BadImageFormatException.
This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed.
In response to that, I targetted my build to the x86 platform:

To my surprise, when trying to execute that new build on the Win7 platform.
The NHibernate assembly is loaded at runtime by `Assembly.Load("...");`.
Could it be that the NHibernate DLL still runs in 64 bit mode whilst the host exe runs in 32 bit mode. That sounds strange to me. Or could it be that for whatever reason, my application runs in 64 bit mode even though it was targeted to x86?
---
I checked my binary using CorFlags, and it is marked 32 bit:
```
Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Version : v2.0.50727
CLR Header: 2.5
PE : PE32
CorFlags : 3
ILONLY : 1
32BIT : 1
Signed : 0
```
I also checked it in Task Manager, and it has a `*32` suffix.
I also tried and used CorFlags to add the 32bit flag to assemblies that come with my application. It still yields the same error message.
I'm puzzled... puzzled... puzzled...
|
How to force .NET application to run in 32bit mode
|
CC BY-SA 3.0
| 0 |
2011-06-29T15:20:23.807
|
2015-04-17T21:07:13.040
|
2011-12-24T18:37:33.387
| 830,125 | 55,787 |
[
".net-3.5",
"x86",
"64-bit",
"corflags"
] |
6,523,111 | 1 | 6,523,180 | null | 0 | 1,895 |
before reading my problem this work in a normal dynamic web project
i create a web service like this methode:
[http://www.youtube.com/watch?v=o2Vjs8ylmFM](http://www.youtube.com/watch?v=o2Vjs8ylmFM)
using CFX 2.4 and with the 2.5 dynamic web model version and when i run hibernate in this current client web project generated by the web service i get an exception
this is it:
```
Etat HTTP 500 -
--------------------------------------------------------------------------------
type Rapport d''exception
message
description Le serveur a rencontré une erreur interne () qui l'a empêché de satisfaire la requête.
exception
org.apache.jasper.JasperException: Impossible de compiler la classe pour la JSP:
An error occurred at line: 1 in the generated java file
The type net.sf.hibernate.Session cannot be resolved. It is indirectly referenced from required .class files
Une erreur s'est produite à la ligne: 16 dans le fichier jsp: /JSP/ebook/index.jsp
Session cannot be resolved to a type
13: <BODY>
14: <%
15:
16: Session hibernateSession = HibernateUtil.currentSession();
17: Transaction tx = hibernateSession.beginTransaction();
18:
19: Etudinat etudiant = new Etudinat();
Une erreur s'est produite à la ligne: 16 dans le fichier jsp: /JSP/ebook/index.jsp
```
and my class hibernateUtil is :
```
package DBase;
import net.sf.hibernate.*;
import net.sf.hibernate.cfg.*;
public class HibernateUtil {
private static final SessionFactory sessionFactory;
static {
try {
// Crée la SessionFactory
sessionFactory =
new Configuration().configure().buildSessionFactory();
} catch (HibernateException ex) {
throw new RuntimeException("Problème de configuration : "
+ ex.getMessage(), ex);
}
}
public static final ThreadLocal session = new ThreadLocal();
public static Session currentSession()
throws HibernateException {
Session s = (Session) session.get();
// Ouvre une nouvelle Session, si ce Thread n'en a aucune
if (s == null) {
s = sessionFactory.openSession();
session.set(s);
}
return s;
}
```
and my hibernate.cfg.xml page is:
```
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory >
<!-- local connection properties -->
<property name="hibernate.connection.url">jdbc:mysql://localhost/ebook</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">162826</property>
<!-- property name="hibernate.connection.pool_size"></property -->
<!-- dialect for MySQL -->
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<property name="current_session_context_class">thread</property>
<mapping resource="DBase/Favorieensei.hbm" />
<mapping resource="DBase/Ajouter.hbm" />
<mapping resource="DBase/Favorie.hbm" />
<mapping resource="DBase/Enseignant.hbm" />
```
and this is my page jsp
```
<%@page import="DBase.HibernateUtil"%>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%@ page import="DBase.*" %>
<%@ page import="net.sf.hibernate.*" %>
<%@ page import="net.sf.hibernate.cfg.*" %>
<HTML>
<HEAD>
<title>Greetings!</title>
</HEAD>
<BODY>
<%
Session hibernateSession = HibernateUtil.currentSession();
Transaction tx = hibernateSession.beginTransaction();
Etudinat etudiant = new Etudinat();
etudiant.setUserName("davido");
etudiant.setPassword("mioo");
etudiant.setQuestion("best music");
etudiant.setAnswer("rock");
etudiant.setEmail("[email protected]");
etudiant.setNom(".....");
etudiant.setPrenom("....");
etudiant.setSexe("Homme");
etudiant.setIDFilliere(Filliere.INFORMATIQUE);
hibernateSession.save(etudiant);
tx.commit();
HibernateUtil.closeSession();
%>
<br>
<br>
<br>
<br>
<table width="400" border="0" cellspacing="1" cellpadding="0" align="center" class="tableBox">
<tr>
<td CLASS="bluebanner" align="center"> Greetings, </TD>
</tr>
</table>
</BODY>
</HTML>
```
this is my screan shot

plz help us we are running on time i have 3 left to finish it
|
hibernate with web service
|
CC BY-SA 3.0
| null |
2011-06-29T15:22:40.113
|
2011-06-29T15:28:08.183
| null | null | 798,392 |
[
"eclipse",
"web-services",
"hibernate",
"jsp"
] |
6,523,730 | 1 | 6,523,910 | null | 0 | 8,832 |
I have a problem in my hand.
I have a URL, And when i initiate the connect to this url and execute url.getContent().
The response is of type `sun.net.www.protocol.http.HttpURLConnection$HttpInputStream`
I tried to assign the output to `HttpURLConnectionHttpInputStream h = url.getContent()`. But i was unsuccessful.
I imported corresponding libraries to code, but still no luck.
If i inspect the url.getContent() in eclipse, it also shows the variable thei$0 in it.
All i need is a URL in this$0. But till now i am unable to retreive it.

In this$0 there is a variable names url and i am trying to fetch it.
I also have hard time understand this$0 and hoe to retrieve it.
After using the streams i get some non readable output

Regards
Dheeraj Joshi
|
Problem in getting url.getContent()
|
CC BY-SA 3.0
| null |
2011-06-29T16:06:48.747
|
2022-08-16T21:56:54.250
|
2011-06-29T17:04:01.383
| 446,976 | 446,976 |
[
"java"
] |
6,523,816 | 1 | 6,525,561 | null | 2 | 1,428 |
I trying to create "reply" to sticky note annotation using iText, does anyone know how to do that?

Another question: how to modify the date of annotation?
|
How to create "reply" to sticky note annotation in iText
|
CC BY-SA 3.0
| 0 |
2011-06-29T16:13:13.553
|
2011-06-29T18:37:20.517
|
2011-06-29T16:34:50.767
| 548,690 | 548,690 |
[
"java",
"pdf",
"itext"
] |
6,523,974 | 1 | 6,524,281 | null | 19 | 12,857 |
I currently have JTables nested in JScrollPanes like so:

My problem is that the number of rows in each table is variable when the table is created. What I want to do is make the JScrollpane smaller if the table is too short, but I want to keep it at a set size if the table is too long.
How can I accomplish this?
|
Shrink JScroll Pane to same Height as JTable
|
CC BY-SA 3.0
| 0 |
2011-06-29T16:24:58.350
|
2019-07-09T00:45:42.903
| null | null | 374,794 |
[
"java",
"swing",
"jtable",
"jscrollpane"
] |
6,524,010 | 1 | null | null | 2 | 798 |
I have a somewhat complicated requirement for layout of a few Core Animation layers. Basically, I have two layers, with CGImage contents, that need to resize (preserving their aspect ratios), but also cling next to each other in the middle of their parent layer. I've illustrated this below.
(Both of my illustrations show the bounds of Layer A's and Layer B's image contents. It doesn't matter if the layer itself is sized larger.)

The closest I've come so far, using CAConstraintLayoutManager is to get them scaled properly, but centered in their half of the superlayer (below).

I'm getting them to this point with the code below:
```
layerA.contentsGravity = kCAGravityResizeAspect;
[layerA setConstraints:[NSArray arrayWithObjects:
[CAConstraint constraintWithAttribute:kCAConstraintMinX relativeTo:@"superlayer" attribute:kCAConstraintMinX],
[CAConstraint constraintWithAttribute:kCAConstraintMaxX relativeTo:@"superlayer" kcaConstraintMidX],
[CAConstraint constraintWithAttribute:kCAConstraintMinY relativeTo:@"superlayer" attribute:kCAConstraintMinY],
[CAConstraint constraintWithAttribute:kCAConstraintMaxY relativeTo:@"superlayer" attribute:kCAConstraintMaxY],
nil]];
layerB.contentsGravity = kCAGravityResizeAspect;
[layerB setConstraints:[NSArray arrayWithObjects:
[CAConstraint constraintWithAttribute:kCAConstraintMinX relativeTo:@"superlayer" attribute:kCAConstraintMidX],
[CAConstraint constraintWithAttribute:kCAConstraintMaxX relativeTo:@"superlayer" kcaConstraintMaxX],
[CAConstraint constraintWithAttribute:kCAConstraintMinY relativeTo:@"superlayer" attribute:kCAConstraintMinY],
[CAConstraint constraintWithAttribute:kCAConstraintMaxY relativeTo:@"superlayer" attribute:kCAConstraintMaxY],
nil]];
```
How can you resize two layers, and also align them?
One idea that occurred to me was to create a layer that contained A and B, laid out properly, with no margin around the edges, and then scale that. I can't figure out a way to do that, either, though.
|
How do you both align and resize an image CALayer?
|
CC BY-SA 3.0
| null |
2011-06-29T16:28:00.307
|
2011-06-29T19:39:15.110
|
2011-06-29T17:33:10.113
| 105,717 | 105,717 |
[
"cocoa",
"macos",
"layout",
"core-animation",
"calayer"
] |
6,524,016 | 1 | null | null | 0 | 457 |
Firefox 5 renders my site very weirdly. I use Blueprint CSS framework. It was ok before Firefox 5.
For example,

The HTML code for the capture is:
```
<div class="span-24 last">
<table class="stripe">
<thead>
<tr>
<th class="span-2">Date</th>
<th class="span-15">Subject</th>
<th class="span-2">Actions</th>
</tr>
</thead>
<tbody><tr>
<td>09/28/2009</td>
<td>
<a class="subject" href="/posts/278?locale=en">acts_as_list scope</a>
</td>
<td>
<a title="Edit" class="icon" href="/posts/278/edit?locale=en"><span class="ss_sprite ss_page_white_edit"> </span></a>
<a title="Delete" rel="nofollow" data-method="delete" data-confirm="Are you sure?" class="icon" href="/posts/278?locale=en"><span class="ss_sprite ss_delete"> </span></a>
</td>
</tr>
<tr class="even">
<td></td>
<td colspan="2">
<p>acts_as_list :scope => :parent (_id is optional. Use symbol instead of string)</p>
<p>acts_as_list :scope => 'board_name = \'#{board_name}\''</p>
<p>If scope column is not 'xxx_id', use the form above.</p>
<p>use single quote.</p>
<p> </p>
<p>http://macdiggs.com/2007/08/27/customizing-scope-in-acts_as_list/</p>
</td>
</tr>
</tbody></table>
<hr>
</div>
```
Or sometimes, th cells in a tr are wrapped in multiple lines.

```
Here's related css:
.column, .span-1, .span-2, .span-3, .span-4, .span-5, .span-6, .span-7, .span-8, .span-9, .span-10, .span-11, .span-12, .span-13, .span-14, .span-15, .span-16, .span-17, .span-18, .span-19, .span-20, .span-21, .span-22, .span-23, .span-24 {
display: inline;
float: left;
margin-right: 10px;
}
* html .column, * html .span-1, * html .span-2, * html .span-3, * html .span-4, * html .span-5, * html .span-6, * html .span-7, * html .span-8, * html .span-9, * html .span-10, * html .span-11, * html .span-12, * html .span-13, * html .span-14, * html .span-15, * html .span-16, * html .span-17, * html .span-18, * html .span-19, * html .span-20, * html .span-21, * html .span-22, * html .span-23, * html .span-24 {
overflow-x: hidden;
}
.span-15 {
width: 590px;
}
```
I created a jsFiddle example at [http://jsfiddle.net/cgTaB/](http://jsfiddle.net/cgTaB/)
What's going on?
Sam
|
Firefox 5 rendering is very different from the previous version
|
CC BY-SA 3.0
| 0 |
2011-06-29T16:28:23.493
|
2011-06-29T17:36:16.040
|
2011-06-29T17:15:11.433
| 108,000 | 108,000 |
[
"css",
"firefox",
"firefox-5"
] |
6,524,089 | 1 | 6,648,476 | null | 0 | 3,572 |
I have a usb midi controller (uc-33e) and I have a working python script see below.
I would like to be able to control the variables of the python script using my usb controller does anyone have an example of this? I would like to use the "midi learn" function to automatically map a midi control to an object (like in Ardour which is a music program for linux) by ctrl-middle clicking the object and just turning the control on the usb midi controller to map it. But I'm also willing to hard code the midi CC into the python script if needed.

```
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ***************************************************************************
# * Copyright (C) 2011, Paul Lutus *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU General Public License as published by *
# * the Free Software Foundation; either version 2 of the License, or *
# * (at your option) any later version. *
# * *
# * This program is distributed in the hope that it will be useful, *
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
# * GNU General Public License for more details. *
# * *
# * You should have received a copy of the GNU General Public License *
# * along with this program; if not, write to the *
# * Free Software Foundation, Inc., *
# * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
# ***************************************************************************
# version date 01-12-2011
VERSION = '1.1'
import re, sys, os
import gobject
gobject.threads_init()
import gst
import gtk
gtk.gdk.threads_init()
import time
import struct
import math
import random
import signal
import webbrowser
class Icon:
icon = [
"32 32 17 1",
" c None",
". c #2A2E30",
"+ c #333739",
"@ c #464A4C",
"# c #855023",
"$ c #575A59",
"% c #676A69",
"& c #CC5B00",
"* c #777A78",
"= c #DB731A",
"- c #8A8C8A",
"; c #969895",
"> c #F68C22",
", c #A5A7A4",
"' c #F49D4A",
") c #B3B5B2",
"! c #DEE0DD",
" &&&&&&& ",
" &&&===='''''& ",
" &'''''====&'& ",
" +++++&'&&&&& &'& ",
" +@$%****&'&+ &'& ",
" +@**%$@++@&'&*@+ &'& ",
" +@**@+++++++&'&@**@+ &'& ",
" +$*$+++++++++&'&++$*$+ &'& ",
" @*@++++++++++&'&+++@#&&&'& ",
" +*@++++++++#&&&'&+++#=''''& ",
" +*$++++++++#=''''&+++&'>>>'& ",
" @*+++++++++&'>>>'&+++#='''= ",
" +%$++++++++@#='''=#@@++#&&&# ",
" +*@+++++++@@@#&&&#@@@@@++@*+ ",
" +*+++++++@@@@++@$%$$@@@@++*+ ",
" +*++++++@@+@;,,*@@*$$$@@@+*+ ",
" +*@++++@@@%!!!!,;@$*$$$@@@*+ ",
" +%$++++@@+)!!!),-*+-%$$$@$%+ ",
" +@*+++@@@+-!!!,;-%@;%%$$+*@+ ",
" +*@++@@@@+$*-*%@+*-%%$@@*+ ",
" ++*@+@@@$$%@++@%;;*%%$@-$+ ",
" +@%+@@@$$%*;;;;-*%%%@**+ ",
" .+$%@@@$$$*******%$$*-+. ",
" .+@%%@@$$*@*@%%%$%-%+. ",
" .++@%$$$$$$%%%%--@+. ",
" +++@@$%*****%+++ ",
" +++++++++++++@. ",
" @--%@++@$*-%+ ",
" +%,))),;%+. ",
" ++++++. ",
" ",
" "
]
# this should be a temporary hack
class WidgetFinder:
def localize_widgets(self,parent,xmlfile):
# an unbelievable hack made necessary by
# someone unwilling to fix a year-old bug
with open(xmlfile) as f:
for name in re.findall('(?s) id="(.*?)"',f.read()):
if re.search('^k_',name):
obj = parent.builder.get_object(name)
setattr(parent,name,obj)
class ConfigManager:
def __init__(self,path,dic):
self.path = path
self.dic = dic
def read_config(self):
if os.path.exists(self.path):
with open(self.path) as f:
for record in f.readlines():
se = re.search('(.*?)\s*=\s*(.*)',record.strip())
if(se):
key,value = se.groups()
if (key in self.dic):
widget = self.dic[key]
typ = type(widget)
if(typ == list):
widget[0] = value
elif(typ == gtk.Entry):
widget.set_text(value)
elif(typ == gtk.HScale):
widget.set_value(float(value))
elif(typ == gtk.Window):
w,h = value.split(',')
widget.resize(int(w),int(h))
elif(typ == gtk.CheckButton or typ == gtk.RadioButton or typ == gtk.ToggleButton):
widget.set_active(value == 'True')
elif(typ == gtk.ComboBox):
if(value in widget.datalist):
i = widget.datalist.index(value)
widget.set_active(i)
else:
print "ERROR: reading, cannot identify key %s with type %s" % (key,type(widget))
def write_config(self):
with open(self.path,'w') as f:
for key,widget in sorted(self.dic.iteritems()):
typ = type(widget)
if(typ == list):
value = widget[0]
elif(typ == gtk.Entry):
value = widget.get_text()
elif(typ == gtk.HScale):
value = str(widget.get_value())
elif(typ == gtk.Window):
_,_,w,h = widget.get_allocation()
value = "%d,%d" % (w,h)
elif(typ == gtk.CheckButton or typ == gtk.RadioButton or typ == gtk.ToggleButton):
value = ('False','True')[widget.get_active()]
elif(typ == gtk.ComboBox):
value = widget.get_active_text()
else:
print "ERROR: writing, cannot identify key %s with type %s" % (key,type(widget))
value = "Error"
f.write("%s = %s\n" % (key,value))
def preset_combobox(self,box,v):
if(v in box.datalist):
i = box.datalist.index(v)
box.set_active(i)
else:
box.set_active(0)
def load_combobox(self,obj,data):
if(len(obj.get_cells()) == 0):
# Create a text cell renderer
cell = gtk.CellRendererText ()
obj.pack_start(cell)
obj.add_attribute (cell, "text", 0)
obj.get_model().clear()
for s in data:
obj.append_text(s.strip())
setattr(obj,'datalist',data)
class TextEntryController:
def __init__(self,parent,widget):
self.par = parent
self.widget = widget
widget.connect('scroll-event',self.scroll_event)
widget.set_tooltip_text('Enter number or:\n\
Mouse wheel: increase,decrease\n\
Shift/Ctrl/Alt: faster change')
def scroll_event(self,w,evt):
q = (-1,1)[evt.direction == gtk.gdk.SCROLL_UP]
# magnify change if shift,ctrl,alt pressed
for m in (1,2,4):
if(self.par.mod_key_val & m): q *= 10
s = self.widget.get_text()
v = float(s)
v += q
v = max(0,v)
s = self.par.format_num(v)
self.widget.set_text(s)
class SignalGen:
M_AM,M_FM = range(2)
W_SINE,W_TRIANGLE,W_SQUARE,W_SAWTOOTH = range(4)
waveform_strings = ('Sine','Triangle','Square','Sawtooth')
R_48000,R_44100,R_22050,R_16000,R_11025,R_8000,R_4000 = range(7)
sample_rates = ('48000','44100','22050','16000', '11025', '8000', '4000')
def __init__(self):
self.restart = False
# exit correctly on system signals
signal.signal(signal.SIGTERM, self.close)
signal.signal(signal.SIGINT, self.close)
# precompile struct operator
self.struct_int = struct.Struct('i')
self.max_level = (2.0**31)-1
self.gen_functions = (
self.sine_function,
self.triangle_function,
self.square_function,
self.sawtooth_function
)
self.main_color = gtk.gdk.color_parse('#c04040')
self.sig_color = gtk.gdk.color_parse('#40c040')
self.mod_color = gtk.gdk.color_parse('#4040c0')
self.noise_color = gtk.gdk.color_parse('#c040c0')
self.pipeline = False
self.count = 0
self.imod = 0
self.rate = 1
self.mod_key_val = 0
self.sig_freq = 440
self.mod_freq = 3
self.sig_level = 100
self.mod_level = 100
self.noise_level = 100
self.enable = True
self.sig_waveform = SignalGen.W_SINE
self.sig_enable = True
self.sig_function = False
self.mod_waveform = SignalGen.W_SINE
self.mod_function = False
self.mod_mode = SignalGen.M_AM
self.mod_enable = False
self.noise_enable = False
self.sample_rate = SignalGen.R_22050
self.left_audio = True
self.right_audio = True
self.program_name = self.__class__.__name__
self.config_file = os.path.expanduser("~/." + self.program_name)
self.builder = gtk.Builder()
self.xmlfile = 'signalgen_gui.glade'
self.builder.add_from_file(self.xmlfile)
WidgetFinder().localize_widgets(self,self.xmlfile)
self.k_quit_button.connect('clicked',self.close)
self.k_help_button.connect('clicked',self.launch_help)
self.k_mainwindow.connect('destroy',self.close)
self.k_mainwindow.set_icon(gtk.gdk.pixbuf_new_from_xpm_data(Icon.icon))
self.title = self.program_name + ' ' + VERSION
self.k_mainwindow.set_title(self.title)
self.tooltips = {
self.k_sample_rate_combobox : 'Change data sampling rate',
self.k_left_checkbutton : 'Enable left channel audio',
self.k_right_checkbutton : 'Enable right channel audio',
self.k_sig_waveform_combobox : 'Select signal waveform',
self.k_mod_waveform_combobox : 'Select modulation waveform',
self.k_mod_enable_checkbutton : 'Enable modulation',
self.k_sig_enable_checkbutton : 'Enable signal',
self.k_noise_enable_checkbutton : 'Enable white noise',
self.k_mod_am_radiobutton : 'Enable amplitude modulation',
self.k_mod_fm_radiobutton : 'Enable frequency modulation',
self.k_quit_button : 'Quit %s' % self.title,
self.k_enable_checkbutton : 'Enable output',
self.k_help_button : 'Visit the %s Web page' % self.title,
}
for k,v in self.tooltips.iteritems():
k.set_tooltip_text(v)
self.config_data = {
'SampleRate' : self.k_sample_rate_combobox,
'LeftChannelEnabled' : self.k_left_checkbutton,
'RightChannelEnabled' : self.k_right_checkbutton,
'SignalWaveform' : self.k_sig_waveform_combobox,
'SignalFrequency' : self.k_sig_freq_entry,
'SignalLevel' : self.k_sig_level_entry,
'SignalEnabled' : self.k_sig_enable_checkbutton,
'ModulationWaveform' : self.k_mod_waveform_combobox,
'ModulationFrequency' : self.k_mod_freq_entry,
'ModulationLevel' : self.k_mod_level_entry,
'ModulationEnabled' : self.k_mod_enable_checkbutton,
'AmplitudeModulation' : self.k_mod_am_radiobutton,
'FrequencyModulation' : self.k_mod_fm_radiobutton,
'NoiseEnabled' : self.k_noise_enable_checkbutton,
'NoiseLevel' : self.k_noise_level_entry,
'OutputEnabled' : self.k_enable_checkbutton,
}
self.cm = ConfigManager(self.config_file,self.config_data)
self.cm.load_combobox(self.k_sig_waveform_combobox,self.waveform_strings)
self.k_sig_waveform_combobox.set_active(self.sig_waveform)
self.cm.load_combobox(self.k_mod_waveform_combobox,self.waveform_strings)
self.k_mod_waveform_combobox.set_active(self.mod_waveform)
self.cm.load_combobox(self.k_sample_rate_combobox,self.sample_rates)
self.k_sample_rate_combobox.set_active(self.sample_rate)
self.k_sig_freq_entry.set_text(self.format_num(self.sig_freq))
self.k_sig_level_entry.set_text(self.format_num(self.sig_level))
self.k_mod_freq_entry.set_text(self.format_num(self.mod_freq))
self.k_mod_level_entry.set_text(self.format_num(self.mod_level))
self.k_noise_level_entry.set_text(self.format_num(self.noise_level))
self.k_main_viewport_border.modify_bg(gtk.STATE_NORMAL,self.main_color)
self.k_sig_viewport_border.modify_bg(gtk.STATE_NORMAL,self.sig_color)
self.k_mod_viewport_border.modify_bg(gtk.STATE_NORMAL,self.mod_color)
self.k_noise_viewport_border.modify_bg(gtk.STATE_NORMAL,self.noise_color)
self.sig_freq_cont = TextEntryController(self,self.k_sig_freq_entry)
self.sig_level_cont = TextEntryController(self,self.k_sig_level_entry)
self.mod_freq_cont = TextEntryController(self,self.k_mod_freq_entry)
self.mod_level_cont = TextEntryController(self,self.k_mod_level_entry)
self.noise_level_cont = TextEntryController(self,self.k_noise_level_entry)
self.k_mainwindow.connect('key-press-event',self.key_event)
self.k_mainwindow.connect('key-release-event',self.key_event)
self.k_enable_checkbutton.connect('toggled',self.update_values)
self.k_sig_freq_entry.connect('changed',self.update_entry_values)
self.k_sig_level_entry.connect('changed',self.update_entry_values)
self.k_sig_enable_checkbutton.connect('toggled',self.update_checkbutton_values)
self.k_mod_freq_entry.connect('changed',self.update_entry_values)
self.k_mod_level_entry.connect('changed',self.update_entry_values)
self.k_noise_level_entry.connect('changed',self.update_entry_values)
self.k_sample_rate_combobox.connect('changed',self.update_values)
self.k_sig_waveform_combobox.connect('changed',self.update_values)
self.k_mod_waveform_combobox.connect('changed',self.update_values)
self.k_left_checkbutton.connect('toggled',self.update_checkbutton_values)
self.k_right_checkbutton.connect('toggled',self.update_checkbutton_values)
self.k_mod_enable_checkbutton.connect('toggled',self.update_checkbutton_values)
self.k_noise_enable_checkbutton.connect('toggled',self.update_checkbutton_values)
self.k_mod_am_radiobutton.connect('toggled',self.update_checkbutton_values)
self.cm.read_config()
self.update_entry_values()
self.update_checkbutton_values()
self.update_values()
def format_num(self,v):
return "%.2f" % v
def get_widget_text(self,w):
typ = type(w)
if(typ == gtk.ComboBox):
return w.get_active_text()
elif(typ == gtk.Entry):
return w.get_text()
def get_widget_num(self,w):
try:
return float(self.get_widget_text(w))
except:
return 0.0
def restart_test(self,w,pv):
nv = w.get_active()
self.restart |= (nv != pv)
return nv
def update_entry_values(self,*args):
self.sig_freq = self.get_widget_num(self.k_sig_freq_entry)
self.sig_level = self.get_widget_num(self.k_sig_level_entry) / 100.0
self.mod_freq = self.get_widget_num(self.k_mod_freq_entry)
self.mod_level = self.get_widget_num(self.k_mod_level_entry) / 100.0
self.noise_level = self.get_widget_num(self.k_noise_level_entry) / 100.0
def update_checkbutton_values(self,*args):
self.left_audio = self.k_left_checkbutton.get_active()
self.right_audio = self.k_right_checkbutton.get_active()
self.mod_enable = self.k_mod_enable_checkbutton.get_active()
self.sig_enable = self.k_sig_enable_checkbutton.get_active()
self.mod_mode = (SignalGen.M_FM,SignalGen.M_AM)[self.k_mod_am_radiobutton.get_active()]
self.noise_enable = self.k_noise_enable_checkbutton.get_active()
def update_values(self,*args):
self.restart = (not self.sig_function)
self.sample_rate = self.restart_test(self.k_sample_rate_combobox, self.sample_rate)
self.enable = self.restart_test(self.k_enable_checkbutton,self.enable)
self.mod_waveform = self.k_mod_waveform_combobox.get_active()
self.mod_function = self.gen_functions[self.mod_waveform]
self.sig_waveform = self.k_sig_waveform_combobox.get_active()
self.sig_function = self.gen_functions[self.sig_waveform]
self.k_sample_rate_combobox.set_sensitive(not self.enable)
if(self.restart):
self.init_audio()
def make_and_chain(self,name):
target = gst.element_factory_make(name)
self.chain.append(target)
return target
def unlink_gst(self):
if(self.pipeline):
self.pipeline.set_state(gst.STATE_NULL)
self.pipeline.remove_many(*self.chain)
gst.element_unlink_many(*self.chain)
for item in self.chain:
item = False
self.pipeline = False
time.sleep(0.01)
def init_audio(self):
self.unlink_gst()
if(self.enable):
self.chain = []
self.pipeline = gst.Pipeline("mypipeline")
self.source = self.make_and_chain("appsrc")
rs = SignalGen.sample_rates[self.sample_rate]
self.rate = float(rs)
self.interval = 1.0 / self.rate
caps = gst.Caps(
'audio/x-raw-int,'
'endianness=(int)1234,'
'channels=(int)2,'
'width=(int)32,'
'depth=(int)32,'
'signed=(boolean)true,'
'rate=(int)%s' % rs)
self.source.set_property('caps', caps)
self.sink = self.make_and_chain("autoaudiosink")
self.pipeline.add(*self.chain)
gst.element_link_many(*self.chain)
self.source.connect('need-data', self.need_data)
self.pipeline.set_state(gst.STATE_PLAYING)
def key_event(self,w,evt):
cn = gtk.gdk.keyval_name(evt.keyval)
if(re.search('Shift',cn) != None):
mod = 1
elif(re.search('Control',cn) != None):
mod = 2
elif(re.search('Alt|Meta',cn) != None):
mod = 4
else:
return
if(evt.type == gtk.gdk.KEY_PRESS):
self.mod_key_val |= mod
else:
self.mod_key_val &= ~mod
def sine_function(self,t,f):
return math.sin(2.0*math.pi*f*t)
def triangle_function(self,t,f):
q = 4*math.fmod(t*f,1)
q = (q,2-q)[q > 1]
return (q,-2-q)[q < -1]
def square_function(self,t,f):
if(f == 0): return 0
q = 0.5 - math.fmod(t*f,1)
return (-1,1)[q > 0]
def sawtooth_function(self,t,f):
return 2.0*math.fmod((t*f)+0.5,1.0)-1.0
def need_data(self,src,length):
bytes = ""
# sending two channels, so divide requested length by 2
ld2 = length / 2
for tt in range(ld2):
t = (self.count + tt) * self.interval
if(not self.mod_enable):
datum = self.sig_function(t,self.sig_freq)
else:
mod = self.mod_function(t,self.mod_freq)
# AM mode
if(self.mod_mode == SignalGen.M_AM):
datum = 0.5 * self.sig_function(t,self.sig_freq) * (1.0 + (mod * self.mod_level))
# FM mode
else:
self.imod += (mod * self.mod_level * self.interval)
datum = self.sig_function(t+self.imod,self.sig_freq)
v = 0
if(self.sig_enable):
v += (datum * self.sig_level)
if(self.noise_enable):
noise = ((2.0 * random.random()) - 1.0)
v += noise * self.noise_level
v *= self.max_level
v = max(-self.max_level,v)
v = min(self.max_level,v)
left = (0,v)[self.left_audio]
right = (0,v)[self.right_audio]
bytes += self.struct_int.pack(left)
bytes += self.struct_int.pack(right)
self.count += ld2
src.emit('push-buffer', gst.Buffer(bytes))
def launch_help(self,*args):
webbrowser.open("http://arachnoid.com/python/signalgen_program.html")
def close(self,*args):
self.unlink_gst()
self.cm.write_config()
gtk.main_quit()
app=SignalGen()
gtk.main()
```
|
controlling Python script with usb midi controller
|
CC BY-SA 3.0
| null |
2011-06-29T16:32:34.227
|
2011-07-11T09:57:58.213
| null | null | 676,430 |
[
"python",
"midi",
"midi-interface"
] |
6,524,478 | 1 | 6,524,985 | null | 20 | 10,450 |
I am generating a figure that will be used as a column of labels to the right of a three-panel figure, and I would like the title of the figure to right-align as do the labels in the figure itself.
here is a minimal example in which I would like to right-align the title 'words'.
```
ggplot() +
geom_text(aes(y = 1, x = seq(4),
label = c('fee', 'fi', 'fo', 'fum'),
hjust = 1)) +
opts(title = 'words') +
coord_flip() +
scale_y_continuous(breaks = c(0,0), limits = c(0,1))
```
Which produces this:

The answer by @joran is helpful, but it does not align the words with the labels. changing his code from `hjust=1` to `hjust = 0.96` gets close, but this is more of a hack than a satisfying answer.
|
Is it possible to align the title of a ggplot to the right?
|
CC BY-SA 3.0
| 0 |
2011-06-29T17:00:52.893
|
2013-05-22T15:00:15.570
|
2011-06-29T19:38:27.763
| 199,217 | 199,217 |
[
"r",
"ggplot2"
] |
6,524,659 | 1 | 12,736,807 | null | 10 | 9,487 |
I've managed to write a limited video player able to view a .3gp file from internet. The video will be shown centered full screen, maintaining the video aspect ratio. Also, rotations don't interrupt the video, which keeps playing without problems.
Everything seems fine, but... on my HTC Legend when you rotate back to portrait, the video is corrupted, and instead of showing full screen it is displayed at its native pixel size. But rotating again to landscape works and is shown perfectly. Any ideas why? Unfortunately I don't have more hardware to test this on and I've run out of ideas to test.
You can get the full example source code from [https://github.com/gradha/Android-video-stream-rotation](https://github.com/gradha/Android-video-stream-rotation). Here are screen captures of me opening the application, rotating to landscape, touching the screen to display the video controls, then rotating back to portrait to see the corruption.



|
Avoid Android VideoView corruption when rotating back to portrait
|
CC BY-SA 3.0
| 0 |
2011-06-29T17:14:35.193
|
2015-06-08T18:21:32.520
| null | null | 172,690 |
[
"android",
"corruption",
"android-videoview",
"screen-rotation"
] |
6,524,701 | 1 | 6,524,902 | null | -1 | 537 |
I need to write a paper about a web crawler and this web crawler explores the links with breadth-first.
I've made a picture in which i demonstrate the way the crawler explores explores.
Is this correct breadth-first exploration?:

|
Web Crawler with breadth first exploration
|
CC BY-SA 3.0
| null |
2011-06-29T17:17:53.377
|
2011-06-29T17:38:23.600
| null | null | 559,933 |
[
"web-crawler",
"breadth-first-search"
] |
6,524,749 | 1 | 6,527,606 | null | 0 | 113 |

I need to get the Date, DataQuantity, FeetQuantity of the ProductionbyEmployee table and based a OperatorNum on the Employee table. the number of operations is a parameter and using NHibernate
hql query. Nhibernate 3.2
|
how to make a query with NHibernate?
|
CC BY-SA 3.0
| null |
2011-06-29T17:22:48.040
|
2011-06-29T21:41:27.747
| null | null | 708,887 |
[
"c#",
"visual-studio-2010",
"nhibernate"
] |
6,525,030 | 1 | 6,527,548 | null | 2 | 1,202 |
I use this fragent shader (inspired from some tutorial found on the NVIDIA site some time ago). It basically compute bi-linear interpolation of a 2D texture.
```
uniform sampler2D myTexture;
uniform vec2 textureDimension;
#define texel_size_x 1.0 / textureDimension[0]
#define texel_size_y 1.0 / textureDimension[1]
vec4 texture2D_bilinear( sampler2D texture, vec2 uv)
{
vec2 f;
uv = uv + vec2( - texel_size_x / 2.0, - texel_size_y / 2.0);
f.x = fract( uv.x * textureDimension[0]);
f.y = fract( uv.y * textureDimension[1]);
vec4 t00 = texture2D( texture, vec2(uv));
vec4 t10 = texture2D( texture, vec2(uv) + vec2( texel_size_x, 0));
vec4 tA = mix( t00, t10, f.x);
vec4 t01 = texture2D( texture, vec2(uv) + vec2( 0, texel_size_y));
vec4 t11 = texture2D( texture, vec2(uv) + vec2( texel_size_x, texel_size_y));
vec4 tB = mix( t01, t11, f.x);
vec4 result = mix( tA, tB, f.y);
return result;
}
```
It looks quite simple and strait-forward. I recently test it on several ATI cards (latest drivers ...) and I get the following result :
 
(Left : Nearest neighbor) (Right : sharder in use)
As you can see some horizontal and vertical lines appear it's important to mention these are not fixed in the view-port coordinates neither in the texture coordinates.
I had to several shaders to make them work correctly on ATI cards, it's seems NVIDIA implementation is a little more regarding code I wrote some time. But in this case I don't see what I should change !
Anything general I should know about differences between NVIDIA and ATI GLSL implementation to overcome this ?
|
Fragment shaders on ATI cards versus NVIDIA ones
|
CC BY-SA 3.0
| null |
2011-06-29T17:50:01.283
|
2011-06-29T21:35:11.207
| null | null | 659,003 |
[
"c++",
"opengl",
"nvidia",
"shader",
"ati"
] |
6,525,464 | 1 | 6,539,935 | null | 0 | 4,230 |
This question is actually for Unity3D, but it can also be a more general question, so therefore I'm going to make this question as general possible.
Suppose I have a scene with a `camera (near = 0.3, far = 1000, fov = 60)` and I want to draw a skydome that is 10000 units in radius.
The object is not culled by the frustum of the camera, because I'm inside of the dome. But the vertices are culled by some shader somehow and the end-result looks like this:

Now my question is:
> what setting for any engine can I change to make sure that the complete object is drawn and not clipped by the far plane of the camera?
What I don't want is:
- - -
|
Disable culling on an object
|
CC BY-SA 3.0
| null |
2011-06-29T18:27:53.490
|
2011-07-15T03:06:04.033
|
2011-07-15T03:06:04.033
| 11,182 | 363,224 |
[
"graphics",
"unity3d",
"frustum",
"culling"
] |
6,525,431 | 1 | null | null | 0 | 2,174 |
before reading my problem this work in a normal dynamic web project
i create a web service like this methode:
[http://www.youtube.com/watch?v=o2Vjs8ylmFM](http://www.youtube.com/watch?v=o2Vjs8ylmFM)
using CFX 2.4 and with the 2.5 dynamic web model version and when i run hibernate in this current client web project generated by the web service i get an exception
this is it:
```
Etat HTTP 500 -
--------------------------------------------------------------------------------
type Rapport d''exception
message
description Le serveur a rencontré une erreur interne () qui l'a empêché de satisfaire la requête.
exception
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.ExceptionInInitializerError
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:531)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
cause mère
javax.servlet.ServletException: java.lang.ExceptionInInitializerError
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:901)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:830)
org.apache.jsp.index_jsp._jspService(index_jsp.java:112)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
cause mère
java.lang.ExceptionInInitializerError
org.apache.jsp.index_jsp._jspService(index_jsp.java:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
cause mère
java.lang.RuntimeException: Problème de configuration : persistent class not found
Base.HibernateUtil.<clinit>(HibernateUtil.java:16)
org.apache.jsp.index_jsp._jspService(index_jsp.java:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
cause mère
net.sf.hibernate.MappingException: persistent class not found
net.sf.hibernate.cfg.Binder.bindClass(Binder.java:76)
net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:165)
net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095)
net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:841)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:792)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:732)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:719)
Base.HibernateUtil.<clinit>(HibernateUtil.java:14)
org.apache.jsp.index_jsp._jspService(index_jsp.java:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
cause mère
java.lang.ClassNotFoundException: Favorieensei
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1671)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:169)
net.sf.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:268)
net.sf.hibernate.cfg.Binder.bindClass(Binder.java:73)
net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:165)
net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095)
net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:841)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:792)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:732)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:719)
Base.HibernateUtil.<clinit>(HibernateUtil.java:14)
org.apache.jsp.index_jsp._jspService(index_jsp.java:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
note La trace complète de la cause mère de cette erreur est disponible dans les fichiers journaux de Apache Tomcat/7.0.5.
--------------------------------------------------------------------------------
Apache Tomcat/7.0.5
```
and my class hibernateUtil is :
```
package DBase;
import net.sf.hibernate.*;
import net.sf.hibernate.cfg.*;
public class HibernateUtil {
private static final SessionFactory sessionFactory;
static {
try {
// Crée la SessionFactory
sessionFactory =
new Configuration().configure().buildSessionFactory();
} catch (HibernateException ex) {
throw new RuntimeException("Problème de configuration : "
+ ex.getMessage(), ex);
}
}
public static final ThreadLocal session = new ThreadLocal();
public static Session currentSession()
throws HibernateException {
Session s = (Session) session.get();
// Ouvre une nouvelle Session, si ce Thread n'en a aucune
if (s == null) {
s = sessionFactory.openSession();
session.set(s);
}
return s;
}
```
and my hibernate.cfg.xml page is:
```
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory >
<!-- local connection properties -->
<property name="hibernate.connection.url">jdbc:mysql://localhost/ebook</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">162826</property>
<!-- property name="hibernate.connection.pool_size"></property -->
<!-- dialect for MySQL -->
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<property name="current_session_context_class">thread</property>
<mapping resource="DBase/Favorieensei.hbm" />
<mapping resource="DBase/Ajouter.hbm" />
<mapping resource="DBase/Favorie.hbm" />
<mapping resource="DBase/Enseignant.hbm" />
```
and this is my page jsp
```
<%@page import="DBase.HibernateUtil"%>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%@ page import="DBase.*" %>
<%@ page import="net.sf.hibernate.*" %>
<%@ page import="net.sf.hibernate.cfg.*" %>
<HTML>
<HEAD>
<title>Greetings!</title>
</HEAD>
<BODY>
<%
Session hibernateSession = HibernateUtil.currentSession();
Transaction tx = hibernateSession.beginTransaction();
Etudinat etudiant = new Etudinat();
etudiant.setUserName("davido");
etudiant.setPassword("mioo");
etudiant.setQuestion("best music");
etudiant.setAnswer("rock");
etudiant.setEmail("[email protected]");
etudiant.setNom(".....");
etudiant.setPrenom("....");
etudiant.setSexe("Homme");
etudiant.setIDFilliere(Filliere.INFORMATIQUE);
hibernateSession.save(etudiant);
tx.commit();
HibernateUtil.closeSession();
%>
<br>
<br>
<br>
<br>
<table width="400" border="0" cellspacing="1" cellpadding="0" align="center" class="tableBox">
<tr>
<td CLASS="bluebanner" align="center"> Greetings, </TD>
</tr>
</table>
</BODY>
</HTML>
```
this is my screan shot

plz help us we are running on time i have 3 left to finish it
|
hibernate class not found exception
|
CC BY-SA 3.0
| 0 |
2011-06-29T18:25:14.693
|
2011-06-29T19:55:42.183
|
2011-06-29T19:55:42.183
| 798,392 | 798,392 |
[
"eclipse",
"web-services",
"hibernate",
"jsp",
"exception"
] |
6,525,483 | 1 | 6,525,777 | null | 2 | 3,017 |
I'm trying to draw an arc on a canvas in Javascript, but I want to get rid of the line that Javascript automatically draws. With the line being drawn, there are two problems:
a) fill() malfunctions
b) It looks like a bow
Here's an image of what I have and what I want: 
The left is what I have in JS, the right is what I have in Java. The Java implementation is fairly inefficient and I would like to use the functions already available.
Here are the relevant JS functions:
```
function pointAt(center, l, theta){
return {
x : Math.sin(theta) * l + center.x,
y : Math.cos(theta) * l + center.y
};
}
function drawArc(ctx, center, l, theta, sweep, label, thickness){
var p0 = pointAt(center, l, theta);
var p1 = pointAt(center, l + thickness, theta);
var p2 = pointAt(center, l + thickness, theta + sweep);
var p3 = pointAt(center, l, theta + sweep);
ctx.fillStyle = "red";
drawPoint(ctx, p0);
ctx.fillStyle = "blue";
drawPoint(ctx, p1);
ctx.fillStyle = "green";
drawPoint(ctx, p2);
ctx.fillStyle = "yellow";
drawPoint(ctx, p3);
ctx.beginPath();
ctx.moveTo(p0.x, p0.y);
ctx.lineTo(p1.x, p1.y);
ctx.arc(center.x, center.y, l + thickness, theta, theta + sweep, false);
ctx.moveTo(p2.x, p2.y);
ctx.lineTo(p3.x, p3.y);
ctx.arc(center.x, center.y, l, theta + sweep, theta, true)
ctx.closePath();
ctx.fill();
ctx.stroke();
//TODO: draw label!!!
}
function drawPoint(ctx, p){
ctx.fillRect(p.x - 4, p.y - 4, 8, 8);
}
```
Here's a working implementation in Java:
```
private static void drawArc(Graphics g, Point center, int l, double theta, double sweep, String label, int thickness){
for (double i = 0; i < thickness; i+=.5) { //hardcoded
Point last = pointAt(center, l + i, theta);
for(double t = theta; t < theta + sweep; t+=.01){
Point cur = pointAt(center, l + i, t);
g.drawLine(last.x, last.y, cur.x, cur.y);
last = cur;
}
}
double t = theta + sweep / 2;
Point p = pointAt(center, l + 15, t);
int size = g.getFontMetrics().stringWidth(label);
BufferedImage img = new BufferedImage(size * 2, size * 2, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = img.createGraphics();
g2.setColor(Color.RED);
double rot = (Math.PI / 2 - t);
// System.out.println(rot / Math.PI + "PI");
boolean b = true;
if(rot < -Math.PI / 2){
rot += Math.PI;
b = false;
}
g2.setTransform(AffineTransform.getRotateInstance(rot, size, size));
g2.drawString(label, size, size);
g2.dispose();
if(!b)
size *= 1.75; //magic value or hardcoded???
g.drawImage(img, p.x - size, p.y - size, null);
}
```
So my question:
How do I turn the banana into a thick arc?
|
In Javascript canvas drawing, how do you eliminate the line in arc()?
|
CC BY-SA 3.0
| 0 |
2011-06-29T18:29:57.247
|
2011-10-07T19:38:54.580
| null | null | 582,136 |
[
"javascript",
"html",
"canvas",
"geometric-arc"
] |
6,525,694 | 1 | 6,526,139 | null | 4 | 1,211 |

Is there any algorithm or trick of how to determine the number of gaussians which should be identified within a set of data before applying the expectation maximization algorithm?
For example, in the above illustrated plot of 2 - Dimensional data, when I apply the Expectation Maximization algorithm, I try to fit 4 gaussians to the data and I would obtain the following result.

But what if I wouldn't knew the number of gaussians within the data? Is there any algorithm or trick which I could apply so that I could find out this detail?
|
Expectation Maximization Issue - How to find the optimum number of gaussians within the data
|
CC BY-SA 3.0
| 0 |
2011-06-29T18:50:36.610
|
2017-09-23T13:35:43.083
|
2017-09-23T13:35:43.083
| 3,923,281 | 442,124 |
[
"matlab",
"data-mining",
"expectation-maximization"
] |
6,525,758 | 1 | null | null | 0 | 531 |
I'm trying to figure out how I would go about achieving the visual effect in the screenshot below.

The black line between Options 2 and 3 is the part I'm struggling with. Would this require two tables? Or is there a way to do this using section headers?
|
Black border between two UITableView cells/sections
|
CC BY-SA 3.0
| null |
2011-06-29T18:56:41.393
|
2011-06-29T19:12:44.090
| null | null | 187,825 |
[
"objective-c",
"ios",
"uitableview"
] |
6,525,898 | 1 | null | null | 2 | 4,922 |
The probability distribution of the sum of two random variables, x and y, is given by the convolution of the individual distributions. I'm having some trouble doing this numerically. In the following example, x and y are uniformly distributed, with their respective distributions approximated as histograms. My reasoning says that the histograms should be convoluted to give the distribution of, x+y.
```
from numpy.random import uniform
from numpy import ceil,convolve,histogram,sqrt
from pylab import hist,plot,show
n = 10**2
x,y = uniform(-0.5,0.5,n),uniform(-0.5,0.5,n)
bins = ceil(sqrt(n))
pdf_x = histogram(x,bins=bins,normed=True)
pdf_y = histogram(y,bins=bins,normed=True)
s = convolve(pdf_x[0],pdf_y[0])
plot(s)
show()
```
which gives the following,

In other words, a triangular distribution, as expected. However, I have no idea how to find the x-values. I would appreciate it if someone could correct me here.
|
Finding the convolution of two histograms
|
CC BY-SA 3.0
| 0 |
2011-06-29T19:09:17.373
|
2011-06-30T13:09:06.560
|
2011-06-30T13:09:06.560
| 623,007 | 623,007 |
[
"statistics",
"numpy",
"probability",
"histogram",
"convolution"
] |
6,526,103 | 1 | 6,527,561 | null | 2 | 289 |
In CSS, we have a [box model](http://www.w3.org/TR/CSS2/box.html) to define how border, margin, padding, and fill contribute to the total width and height of a rectangle. I'm porting some of my HTML/CSS design into Flash and can't quite figure out what Flash's box model is. In Flash, I've created a rectangle with gradient fill and a non-scaling 1 pixel stroke. I'm trying to get pixel-perfect positioning and sizing, but the experience has been unpredictable. I'm not really seeing a pattern to the following questions. The answer really changes depending on the exact circumstances.
1. When you set x and y both to be 0, where does the border lay? Is it off the screen? Is it being cut in half by the origin? Or is it completely visible?
2. When you set width to 100, is the fill 98 wide or 100 wide?
3. What happens to the 1px thick border when the rectangle is not positioned at whole number coordinates?
```
var sh:Shape = new Shape();
sh.graphics.lineStyle(1.0, 0x00FF00, 1.0, false, LineScaleMode.NONE);
sh.graphics.beginFill(0xFF0000, 1.0);
sh.graphics.drawRect(0, 0, 100, 100);
sh.graphics.endFill();
addChild(sh);
sh.x = 10;
sh.y = 10;
```
I tried to create a 100x100 square at x:10, y:10. When I measured the total width and height in Photoshop, it came out to be 101x101. Strange! One would either expect the final dimensions to be 100x100 (border on inside) or 102x102 (border on outside).

|
What is the box model for Flash rectangles?
|
CC BY-SA 3.0
| 0 |
2011-06-29T19:25:55.050
|
2015-02-11T12:58:38.380
|
2011-06-29T21:23:21.050
| 459,987 | 459,987 |
[
"flash",
"actionscript-3"
] |
6,526,848 | 1 | 6,527,413 | null | 8 | 3,259 |
I think I am starting to understand how to link functions written in C/C++ to . The problem I'm facing is that I don't know how to send error messages from my C wrapper to Mathematica. After searching in google I found this [MathLink Tutorial](http://www.edenwaith.com/development/tutorials/mathlink/ML_Tut.pdf).
Section 1.7 gave me an insight as to how to send error messages but I am getting weird results. Here is the code I am working with.
---
```
//File cppFunctions.h
#ifndef CPPFUNCTIONS_H
#define CPPFUNCTIONS_H
class Point {
public:
double x, y;
Point(){ x=y=0.0;}
Point(double a, double b): x(a), y(b) {}
};
class Line {
public:
Point p1, p2;
Line(void) {}
Line(const Point &P, const Point &Q): p1(P), p2(Q) {}
double distanceTo(const Line &M, const double &EPS = 0.000001){
double x21 = p2.x - p1.x; double y21 = p2.y - p1.y;
double x43 = M.p2.x - M.p1.x; double y43 = M.p2.y - M.p1.y;
double x13 = p1.x - M.p1.x; double y13 = p1.y - M.p1.y;
double den = y43*x21 - x43*y21;
if (den*den < EPS) return -INFINITY;
double numL = (x43*y13 - y43*x13)/den;
double numM = (x21*y13 - y21*x13)/den;
if (numM < 0 || numM > 1) return -INFINITY;
return numL;
}
};
#endif
```
The file cppFunctions.h declares the classes `Point` and `Line`. I have stripped this class to the bare minium except for the function that I want to use in . I want to find the distance from one line to another. This function is the C version of `lineInt` in [wireframes in Mathematica](https://stackoverflow.com/questions/6353337/mathematica-3d-wire-frames). To use this function in we need a wrapper function that obtains the input from and sends the output back to .
---
```
//mlwrapper.cpp
#include "mathlink.h"
#include <math.h>
#include "cppFunctions.h"
void ML_GetPoint(Point &P){
long n;
MLCheckFunction(stdlink, "List", &n);
MLGetReal64(stdlink, &P.x);
MLGetReal64(stdlink, &P.y);
}
void ML_GetLine(Line &L){
long n;
MLCheckFunction(stdlink, "List", &n);
ML_GetPoint(L.p1);
ML_GetPoint(L.p2);
}
double LineDistance(void) {
Line L, M;
ML_GetLine(L);
ML_GetLine(M);
return L.distanceTo(M);
}
int main(int argc, char* argv[]) {
return MLMain(argc, argv);
}
```
I created two helper functions: `ML_GetPoint` and `ML_GetLine` to help me obtain the input from . A line is obtained from a list containing two list. Each sublist is a list of 2 real numbers (a point). To try this function in Mathematica we need to more files.
---
```
//mlwrapper.tm
double LineDistance P((void));
:Begin:
:Function: LineDistance
:Pattern: LineDistance[L_List, M_List]
:Arguments: {L, M}
:ArgumentTypes: {Manual}
:ReturnType: Real
:End:
:Evaluate: LineDistance::usage = "LineDistance[{{x1,y1}, {x2,y2}}, {{x3,y3}, {x4,y4}}] gives the distance between two lines."
:Evaluate: LineDistance::mlink = "There has been a low-level MathLink error. The message is: `1`"
```
This file states that the function LineDistance will obtain the arguments manually and that it will return a real number. The last two lines are important. The first `Evaluate` declares the `usage` of the function. It gives a brief message about the function when `?LineDistance` is entered into . The other `Evaluate` is the one I wish to use whenever there is an error (more on this later).
---
```
#Makefile
VERSION=8.0
MLINKDIR = .
SYS = MacOSX-x86-64
CADDSDIR = /Applications/Mathematica.app/SystemFiles/Links/MathLink/DeveloperKit/CompilerAdditions
INCDIR = ${CADDSDIR}
LIBDIR = ${CADDSDIR}
MPREP = ${CADDSDIR}/mprep
RM = rm
CXX = g++
BINARIES = mlwrapper
all : $(BINARIES)
mlwrapper : mlwrappertm.o mlwrapper.o
${CXX} -I${INCDIR} mlwrappertm.o mlwrapper.o -L${LIBDIR} -lMLi3 -lstdc++ -framework Foundation -o $@
.cpp.o :
${CXX} -c -I${INCDIR} $<
mlwrappertm.cpp : mlwrapper.tm
${MPREP} $? -o $@
clean :
@ ${RM} -rf *.o *tm.c mlwrappertm.cpp
```
Last file is the Makefile. At this point we are all set to test the function in Mathematica.
---
I should have mentioned before that I'm using Mac OS X, I'm not sure how this will work on Windows. In the mlwrapper.cpp the main function needs a lot more code which you can find in one of the examples provided by .
In the terminal I know do this:
```
make > makelog.txt
make clean
```
This make the executable `mlwrapper`. Now we can start using Mathematica:
```
SetDirectory[NotebookDirectory[]];
link = Install["mlwrapper"];
?LineDistance
Manipulate[
Grid[{{
Graphics[{
Line[{p1, p2}, VertexColors -> {Red, Red}],
Line[{p3, p4}]
},
PlotRange -> 3, Axes -> True],
LineDistance[{p1, p2}, {p3, p4}]
}}],
{{p1, {-1, 1}}, Locator, Appearance -> "L1"},
{{p2, {2, 1}}, Locator, Appearance -> "L2"},
{{p3, {2, -2}}, Locator, Appearance -> "M1"},
{{p4, {2, 3}}, Locator, Appearance -> "M2"}
```
]
The output we obtain is the following:

Everything works fine as long as you enter the correct arguments. That is, 2 lists, each one being a list of 2 lists of 2 doubles. Maybe there is another way of obtaining the inputs, if you know how to please let me know. If we stick to this method all we need is a way of letting the user know if there are any errors. A very simple one is entering the incorrect input. Lets say I enter this:
```
LineDistance[{{0, 0}, {0}}, {{1, -1}, {1, 1}}]
```
The output is `$Failed`. How about the following:
```
LineDistance[{{1, -1}, {1, 1}}]
```
The output is `LineDistance[{{1, -1}, {1, 1}}]`. I'm guessing this happens because we described in `Pattern` section of the `.tm` that the function accepts two lists and since we only gave one it doesn't match the pattern. Is this true?
In any case, following the tutorial I found lets modify the file mlwrapper.cpp as follows:
```
#include "mathlink.h"
#include <math.h>
#include <string>
#include "cppFunctions.h"
bool ML_Attempt(int func, const char* err_tag){
if (!func) {
char err_msg[100];
sprintf(err_msg, "Message[%s,\"%.76s\"]", err_tag, MLErrorMessage(stdlink));
MLClearError(stdlink); MLNewPacket(stdlink); MLEvaluate(stdlink, err_msg);
MLNextPacket(stdlink); MLNewPacket(stdlink); MLPutSymbol(stdlink, "$Failed");
return false;
}
return true;
}
void ML_GetPoint(Point &P){
long n;
if(!ML_Attempt(MLCheckFunction(stdlink, "List", &n), "LineDistance::mlink2"))return;
if(!ML_Attempt(MLGetReal64(stdlink, &P.x), "LineDistance::mlink3")) return;
if(!ML_Attempt(MLGetReal64(stdlink, &P.y), "LineDistance::mlink4")) return;
}
void ML_GetLine(Line &L){
long n;
if(!ML_Attempt(MLCheckFunction(stdlink, "List", &n), "LineDistance::mlink1"))return;
ML_GetPoint(L.p1);
ML_GetPoint(L.p2);
}
double LineDistance(void) {
Line L, M;
ML_GetLine(L);
ML_GetLine(M);
return L.distanceTo(M);
}
int main(int argc, char* argv[]) {
return MLMain(argc, argv);
}
```
And add the following to the end of the mlwrapper.tm file
```
:Evaluate: LineDistance::mlink1 = "There has been a low-level MathLink error. The message is: `1`"
:Evaluate: LineDistance::mlink2 = "There has been a low-level MathLink error. The message is: `1`"
:Evaluate: LineDistance::mlink3 = "There has been a low-level MathLink error. The message is: `1`"
:Evaluate: LineDistance::mlink4 = "There has been a low-level MathLink error. The message is: `1`"
```
Now lets use make and try to make some mistakes in Mathematica.
I'm posting a screenshot of what output instead of writing everything.

Notice how we get different errors after we repeat the call. It seems that the function continues at the line after the error was encountered. If I don't use any of the other ML functions like in the function `ML_Attempt` and I only use the `MLEvaluate` to send the error tag then the MathLink is broken and I have to re-install the link. Does anyone know how to send error messages to from C?
---
## UPDATE:
Based on the answers that have been given and another useful [document](http://library.wolfram.com/infocenter/Books/3710/) (Chapter 8) I managed to make it work. The code isn't so pretty at the moment but this made me ask the following question. Is it possible to terminate a function earlier? In a regular C program if I encounter an error I would print an error message and use the `exit` function. Can we do something similar? If we use the `exit` function the link will be broken and we will have to re-install the function. Take the functions `ML_GetPoint` and `ML_GetLine` for example. If an error occurred here then there is no point on procedding doing the calculations in the main function `LineDistance`. We need to clear whatever error we have obtained, send a message to Mathematica specifying the error, quit for now and wait for the next call.
|
Mathematica: MathLink error messages
|
CC BY-SA 3.0
| 0 |
2011-06-29T20:29:35.320
|
2011-08-05T03:38:14.353
|
2017-05-23T12:07:06.850
| -1 | 788,553 |
[
"c++",
"wolfram-mathematica",
"mathlink"
] |
6,527,374 | 1 | null | null | 2 | 3,019 |
It's a long story, but I will try make it simple:
1. I generated MeterMaid XML files with SugarMMM; I chose only the Accounts module:
2. I converted above files to JMeter format with MeterMaid (I consolidated the tests into one file and named it "filename.xml"): ruby GenMeter.rb --inputfile=filename.xml --outputfile=filename.jmx
3. I did the necessary CSV setup. All the CSV file contains is the login details (usr,pwd) for testing concurrent user logins. This part works well indeed.
When I run the test, I can see that a whole bunch of `${}` variables are converted into corresponding values. Sadly, `${SUBPANEL_RELATE_MODULE_g1}` doesn't get resolved... here's what the GET url (from Listener component) looks like:
```
http://localhost/sugarcrm/index.php?module=${SUBPANEL_RELATE_MODULE_g1}&action=Popup&hide_clear_button=true&mode=MultiSelect&create=true&metadata=undefined
```
Note that it's not the only variable that isn't resolved. The following screenshot shows the other tests that fail, all also caused by other variables not replaced by their corresponding values:

Here's how this variable is set up (which is well before the time it's used):

Here's what [Debug Sampler](http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Debug_Sampler) says:
```
JMeterVariables:
CAMPAIGN_ID=CAMPAIGN_ID_ERROR
CAMPAIGN_NAME=CAMPAIGN_NAME_ERROR
CONTACT_ID=997a3171-aa60-b2d6-a457-4e0ba8b0052b
CONTACT_ID_g=4
CONTACT_ID_g0=onclick="send_back('Contacts','997a3171-aa60-b2d6-a457-4e0ba8b0052b');">Prof
CONTACT_ID_g1=onclick="send_back('Contacts','
CONTACT_ID_g2=997a3171-aa60-b2d6-a457-4e0ba8b0052b
CONTACT_ID_g3=');">
CONTACT_ID_g4=Prof
CONTACT_NAME=Prof
CONTACT_NAME_g=4
CONTACT_NAME_g0=onclick="send_back('Contacts','997a3171-aa60-b2d6-a457-4e0ba8b0052b');">Prof
CONTACT_NAME_g1=onclick="send_back('Contacts','
CONTACT_NAME_g2=997a3171-aa60-b2d6-a457-4e0ba8b0052b
CONTACT_NAME_g3=');">
CONTACT_NAME_g4=Prof
FOUND_ID=1
JMeterThread.last_sample_ok=true
JMeterThread.pack=org.apache.jmeter.threads.SamplePackage@3c1635
MEMBER_OF_ID=d7c26344-cad8-0503-b02a-4e0cb4db3985
MEMBER_OF_ID_g=4
MEMBER_OF_ID_g0=onclick="send_back('Accounts','d7c26344-cad8-0503-b02a-4e0cb4db3985');">searchSearchForm
MEMBER_OF_ID_g1=onclick="send_back('Accounts','
MEMBER_OF_ID_g2=d7c26344-cad8-0503-b02a-4e0cb4db3985
MEMBER_OF_ID_g3=');">
MEMBER_OF_ID_g4=searchSearchForm
MEMBER_OF_NAME=searchSearchForm
MEMBER_OF_NAME_g=4
MEMBER_OF_NAME_g0=onclick="send_back('Accounts','d7c26344-cad8-0503-b02a-4e0cb4db3985');">searchSearchForm
MEMBER_OF_NAME_g1=onclick="send_back('Accounts','
MEMBER_OF_NAME_g2=d7c26344-cad8-0503-b02a-4e0cb4db3985
MEMBER_OF_NAME_g3=');">
MEMBER_OF_NAME_g4=searchSearchForm
OPPORTUNITY_ID=864e402f-0d76-ab6e-b54f-4e0cb42f0249
OPPORTUNITY_ID_g=4
OPPORTUNITY_ID_g0=onclick="send_back('Opportunities','864e402f-0d76-ab6e-b54f-4e0cb42f0249');">value
OPPORTUNITY_ID_g1=onclick="send_back('Opportunities','
OPPORTUNITY_ID_g2=864e402f-0d76-ab6e-b54f-4e0cb42f0249
OPPORTUNITY_ID_g3=');">
OPPORTUNITY_ID_g4=value
OPPORTUNITY_NAME=value
OPPORTUNITY_NAME_g=4
OPPORTUNITY_NAME_g0=onclick="send_back('Opportunities','864e402f-0d76-ab6e-b54f-4e0cb42f0249');">value
OPPORTUNITY_NAME_g1=onclick="send_back('Opportunities','
OPPORTUNITY_NAME_g2=864e402f-0d76-ab6e-b54f-4e0cb42f0249
OPPORTUNITY_NAME_g3=');">
OPPORTUNITY_NAME_g4=value
RANDOM_CHAR=o
RANDOM_CHAR_g=1
RANDOM_CHAR_g0=o
RANDOM_CHAR_g1=o
RANDOM_STRING=value
RANDOM_STRING_g=1
RANDOM_STRING_g0=value
RANDOM_STRING_g1=value
RECORD_NAME=NOT_FOUND
RECORD_NUMBER=3250317d-6c79-b20d-5e36-4e0cb4746e84
RECORD_NUMBER_g=2
RECORD_NUMBER_g0=javascript:lvg_nav('Accounts', '3250317d-6c79-b20d-5e36-4e0cb4746e84
RECORD_NUMBER_g1=javascript:lvg_nav('Accounts', '
RECORD_NUMBER_g2=3250317d-6c79-b20d-5e36-4e0cb4746e84
SEARCH_FIELD=SEARCH_FIELD_ERROR
START.HMS=190308
START.MS=1309453388621
START.YMD=20110630
SUBPANEL_RELATE_MODULE=Accounts
TEAM_ID=seed-Teams8
TEAM_ID_g=4
TEAM_ID_g0=onclick="send_team_to_form('Teams','seed-Teams8');">Ball
TEAM_ID_g1=onclick="send_team_to_form('Teams','
TEAM_ID_g2=seed-Teams8
TEAM_ID_g3=');">
TEAM_ID_g4=Ball
TEAM_NAME=Ball
TEAM_NAME_g=4
TEAM_NAME_g0=onclick="send_team_to_form('Teams','seed-Teams8');">Ball
TEAM_NAME_g1=onclick="send_team_to_form('Teams','
TEAM_NAME_g2=seed-Teams8
TEAM_NAME_g3=');">
TEAM_NAME_g4=Ball
TESTSTART.MS=1309455500088
pwd=user1
usr=user1
```
:
Here's after changing to `$1$$2$$3$$4$`:

And here's the Debug output (the Sampler is put just after regex Controller):
```
JMeterVariables:
JMeterThread.last_sample_ok=true
JMeterThread.pack=org.apache.jmeter.threads.SamplePackage@18fde89
RANDOM_CHAR=t
RANDOM_CHAR_g=1
RANDOM_CHAR_g0=t
RANDOM_CHAR_g1=t
RANDOM_STRING=Tanzania
RANDOM_STRING_g=1
RANDOM_STRING_g0=Tanzania
RANDOM_STRING_g1=Tanzania
RECORD_NAME=NOT_FOUND
RECORD_NUMBER=DOCTYPE
RECORD_NUMBER_g=1
RECORD_NUMBER_g0=DOCTYPE
RECORD_NUMBER_g1=DOCTYPE
START.HMS=100932
START.MS=1312531772599
START.YMD=20110805
SUBPANEL_RELATE_MODULE=Accounts
TESTSTART.MS=1312542237235
pwd=user1
usr=user1
```
|
JMeter does not replace ${SUBPANEL_RELATE_MODULE_g1} with its value
|
CC BY-SA 3.0
| null |
2011-06-29T21:17:33.853
|
2016-03-16T08:35:02.590
|
2020-06-20T09:12:55.060
| -1 | 321,731 |
[
"jmeter"
] |
6,527,424 | 1 | 6,527,504 | null | 2 | 330 |
I just came across
# this
It looks pretty awesome so i of course went but all i saw was a bunch of `script` tags and one single `canvas` tag with text saying "".

Why can't i see what is happening in the html? and do you have a rough idea of how they built this?
|
Google's "Beat the boot"
|
CC BY-SA 3.0
| null |
2011-06-29T21:22:56.613
|
2011-06-29T21:42:48.583
|
2011-06-29T21:42:48.583
| 77,047 | 459,688 |
[
"javascript",
"jquery",
"google-chrome",
"canvas"
] |
6,527,531 | 1 | null | null | 2 | 5,570 |
I didn't like any available solutions so I started to make my own wizard interface. I use a GroupBox for each step of the wizard but since every step (every GroupBox) must have the same structure and style, I decided to use custom controls.
Now I need a custom GroupBox which has these elements:
- A FlowLayoutPanel so the developer can put desired controls in it using the designer. (For example two TextBox controls so the user can enter a username and a password.)- A Label in that FlowLayoutPanel to describe the step.- A Button to go back.- Another FlowLayoutPanel that user can put custom buttons in.
Here is a preview:

# Problem #1
When I create a new UserControl and make it inherit the GroupBox, I can't get a GroupBox that I can put and position stuff in it. All I see in the designer is this message:

# Problem #2
Since I couldn't make it inherit GroupBox like I wanted it to, I tried doing it by putting a GroupBox in the custom UserControl. (I don't want this. I just did this so I could provide some screenshots.) After I did that, I had to EnableDesignMode on the FlowLayoutPanels so the developer could add controls in them by using the designer. The problem is that they also became movable and resizable (I don't want this. They are anchored properly and they should not be moved nor resized.) and when you try to move them you get "Object reference not set to an instance of an object." which is making it uglier:

# Problem #3
I want elements in the main FlowLayoutPanel to be centered. To do this, I had to put a control (the description label) and resize it to the width of the FlowLayoutPanel so the controls after it would be centered. (Messy workaround if you ask me. Doing this with TableLayoutPanel looked easier but their cells can only hold one element. You can add a Panel to make the cell hold more elements but then you lose centering.) The problem is that I have to set Anchor to None for every control I add. Can I hook something (like OnDesignerControlAdded???) to automatically set added control's Anchor to None?

All of your answers will help me build the open source project [Magician on GitHub](https://github.com/AlicanC/Magician) and many other open source projects powered by it. Thanks in advance for all of your efforts.
|
Custom GroupBox control with other controls inside
|
CC BY-SA 3.0
| 0 |
2011-06-29T21:33:53.497
|
2017-04-18T01:40:56.703
| null | null | 667,234 |
[
"c#",
"winforms",
"visual-studio-2010",
"custom-controls",
"groupbox"
] |
6,527,758 | 1 | 6,527,847 | null | 10 | 33,548 |
I know how to change the background color of a scrollbar:
```
<ScrollBar Height="27" Margin="36,96,12,0" Name="scrollBar1" Background="Red"></ScrollBar>
```
here is the picture with my red background:

How could I do the same thing with ScrollViewer? I have a grid inside my ScrollViewer and if I change the properties of ScrollViewer it seem to change the properties of the content inside my grid.
```
<ScrollViewer>
<Grid Name="Parent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
....
....
... etc
```
that produces:

with the content of my grid named Parent on the left. How could I place a red background on this ScrollViewer?
|
Change background color of ScrollBar in ScrollViewer wpf
|
CC BY-SA 3.0
| 0 |
2011-06-29T21:56:25.237
|
2018-12-18T10:46:10.890
|
2011-06-30T02:00:22.407
| 546,730 | 637,142 |
[
"c#",
"wpf",
"templates",
"xaml",
"styles"
] |
6,527,987 | 1 | 6,528,044 | null | 0 | 1,292 |
The nav div must be fixed vertically and sitting to the right side of container div.
Using `position:fixed;` and setting values left and top, you get the div to stay in the same place, but the left value depends since the parent div (page-container) gets centered.
```
<html>
<body>
<div id="page-container" style="width: 700px; height:1000px; margin-left: auto; margin-right: auto;background-color:moccasin;">
<div class="content" style=" width: 340px; height:300px; float:left;background-color:mediumseagreen;">
.content
</div>
<div class="nav" style="float:left;height: auto; width: 300px; display: block;background-color:lightblue;">
.nav <br><br>This div must:<br>
1. be fixed vertically (if scrolling down, you should see me in the same place) <br>
2. be aligned to the right side of <b>content</b>
</div>
</div>
</body>
</html>
```

|
Fixed div vertically and right aligned to another div
|
CC BY-SA 3.0
| null |
2011-06-29T22:26:04.480
|
2011-07-17T19:31:59.573
|
2011-07-17T19:31:59.573
| 560,648 | 129,103 |
[
"css",
"position",
"html"
] |
6,528,053 | 1 | null | null | 1 | 1,006 |
I am trying to create a button which is capable of resizing itself depending on the size of the text within it. The button is defined by the HTML text below. The whole button is defined as a `<span>`, and has three constituent components: the left curved portion of the button, the center body of the button (houses the text and expands accordingly), and the right curved part of the button. The right and left parts of the button are actually mirror images of each other.
The current code looks completely fine on Firefox and IE8, but when I view it on IE7, the right curved part floats to the right (this is correct), but the left and center float to the left of the panel that the button is in. This is not correct, and I wish to remedy this. However, trying to deal with this problem since it's IE related is a major pain for me. Can anyone suggest a solution or a work-around? Here is a picture for the button. `xp-b-left` defines the left side of the button and `xp-b-right` the right side of the button.

This is how the button looks like on IE7:

This is how the button looks like on Chrome, FF and IE8+ (no left float and no superfluous space between text and edges within button):

```
<span class="xp-b-submit xp-b-submit-flt xp-l-il xp-b-right">
<span class="xp-b-leftSide">
<!---->
</span>
<a href="#" class="xp-t-bold" id="flightSubmitLink">
Search
</a>
<span class="xp-b-rightSide">
<!---->
</span>
</span>
```
CSS for the button:
```
.xp-b-submit-flt {
background: url("../../images/new_blue_button.png") no-repeat scroll -22px 50% transparent;
}
.xp-b-submit {
background-position: right -32px;
}
.xp-b-submit, .xp-b-leftSide, .xp-b-submit-large, .xp-b-submit-large .xp-b-leftSide, .xp-b-rightSide {
background: url("../images/buttonBG.png") no-repeat scroll 0 0 transparent;
display: inline-block;
}
.xp-b-rightfloat {
float: right;
}
.xp-b-leftSide {
background-position: left -32px;
float: left;
height: 19px;
width: 3px;
}
.xp-b-submit a#flightSubmitLink {
padding-left: 8px;
padding-right: 8px;
padding-top: 3px;
}
.xp-b-submit a, .xp-b-submit input {
color: #FFFFFF !important;
font-size: 10px;
padding: 5px 5px 4px 2px;
}
.xp-b-submit a, .xp-b-submit input, .xp-b-submit-large a, .xp-b-submit-large input {
float: left;
text-align: center;
text-decoration: none;
text-transform: uppercase;
}
.xp-t-bold {
font-weight: bold !important;
}
.xp-b-rightSide {
background-position: right -32px;
float: right;
height: 19px;
width: 3px;
}
```
|
Spans, buttons, and IE7 float bugs
|
CC BY-SA 3.0
| null |
2011-06-29T22:35:30.533
|
2011-06-29T22:48:39.820
|
2011-06-29T22:46:18.370
| 155,726 | 155,726 |
[
"html",
"css",
"internet-explorer-7"
] |
6,528,299 | 1 | 6,528,752 | null | 2 | 2,457 |
I am using the following code:
```
public final class TableCellRendererCenter extends DefaultTableCellRenderer {
public static final TableCellRenderer INSTANCE
= new TableCellRendererCenter();
protected TableCellRendererCenter() {
// Calling super
super();
this.setHorizontalAlignment(SwingConstants.CENTER);
}
}
```
on a JTable column:
```
TableColumnModel retrMod = ChartItemsTable.getColumnModel();
TableColumn retrCol = retrMod.getColumn(2);
retrCol.setHeaderRenderer(TableCellRendererCenter.INSTANCE);
retrCol.setCellRenderer(TableCellRendererCenter.INSTANCE);
```
and the look-and-feel does not match other column headers anymore:

Why? How can I solve this issue?
It seems like NetBeans is using `DefaultTableCellHeaderRenderer` which is coming from `package sun.swing.table;`
I read everywhere that I should not use sun packages. Grrrr... this does not help!
The suggestion of 0verbose produces the following:

Following eugener's suggestion, I updated my code as following:
```
public final class TableCellRendererCenter extends DefaultTableCellRenderer {
@Override
public Component getTableCellRendererComponent(
JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column) {
// returns component used for default header rendering
// makes it independent on current L&F
Component retr = table.getTableHeader().getDefaultRenderer().
getTableCellRendererComponent(
table, value, isSelected, hasFocus, row, column);
if ( JLabel.class.isAssignableFrom(retr.getClass()) ) {
JLabel jl = (JLabel) retr;
jl.setHorizontalAlignment(SwingConstants.CENTER);
}
return retr;
}
@Override
public void validate() {}
@Override
public void revalidate() {}
@Override
public void firePropertyChange(
String propertyName, boolean oldValue, boolean newValue) {}
@Override
public void firePropertyChange(
String propertyName, Object oldValue, Object newValue) {}
}
```
And I get this:

Look-and-feel is preserved and column header is centered !!! (Other column headers are centered too, but I can control this by making further tests on the `int row, int column` parameters).
|
Look-and-feel issue when centering JTable column header
|
CC BY-SA 3.0
| 0 |
2011-06-29T23:08:23.520
|
2011-07-05T19:20:58.273
|
2011-06-30T01:21:56.437
| 520,957 | 520,957 |
[
"java",
"swing",
"look-and-feel",
"jtableheader"
] |
6,528,386 | 1 | 6,528,423 | null | 0 | 223 |
I have this page: [http://jsfiddle.net/minitech/yU3aj/show/](http://jsfiddle.net/minitech/yU3aj/show/)
If you look in the source, the CSS defines that the `<header>` should have side padding of 135px on each side, and the content should have 135px margin on each side. Why does the content end up having double that in spacing?

|
Why does the padding of one element affect the margin of another?
|
CC BY-SA 3.0
| null |
2011-06-29T23:23:06.203
|
2011-06-29T23:39:46.343
|
2011-06-29T23:32:41.077
| 707,111 | 707,111 |
[
"html",
"css"
] |
6,528,496 | 1 | null | null | 3 | 1,320 |
I've added department approvals to the standard CMMI-Template Requirement work-item. I'd like to limit the System.State field such that it can only be changed from to when all department approvals are set to "Yes".

I've tried the following change to Requirement.xml
```
<FIELD name="State" refname="System.State" type="String" reportable="dimension">
<WHEN field="Approval.Marketing" value="No">
<READONLY />
</WHEN>
<WHEN field="Approval.Quality" value="No">
<READONLY />
</WHEN>
<WHEN field="Approval.RD" value="No">
<READONLY />
</WHEN>
<WHEN field="Approval.System" value="No">
<READONLY />
</WHEN>
<WHEN field="Approval.ProgManagement" value="No">
<READONLY />
</WHEN>
</FIELD>
```
This causes the State field to become READONLY if any of the approval fields are set to "No" which is what I want. However it causes problems when creating a new requirement since the approvals are all "No" initially and thus the initial "Proposed" default for State doesn't get set due to READONLY condition. What I'd like is to do is add logic to the WHEN conditions above to them with the condition System.State="Proposed". I tried nesting WHEN clauses such as
```
<FIELD name="State" refname="System.State" type="String" reportable="dimension">
<WHEN field="System.State" value="Proposed">
<WHEN field="Approval.Marketing" value="No">
<READONLY />
</WHEN>
. . .
</WHEN>
</FIELD>
```
But this gets an error on import that clause cannot contain . How can I prohibit State change from to when any of the Approval fields are set to "No"
|
How can I prohibit State change from Proposed to Active in TFS Requirement work-item based on value of another field?
|
CC BY-SA 3.0
| 0 |
2011-06-29T23:41:03.367
|
2015-03-08T16:51:07.243
|
2015-03-08T16:51:07.243
| 736,079 | 673,593 |
[
"tfs",
"field",
"state",
"tfs-workitem",
"tfs-process-template"
] |
6,528,512 | 1 | 6,529,449 | null | 4 | 2,179 |
I am working on a game written in javaScript / jQuery. Part of my code draws a random polygon (an island) on a tile grid. I need to check if a point is inside the polygon.
I am using a point-in-polygon intersection script which I found in [several](https://stackoverflow.com/questions/2212604/javascript-check-mouse-clicked-inside-the-circle-or-polygon/2212851#2212851) [places](https://stackoverflow.com/questions/217578/point-in-polygon-aka-hit-test/2922778#2922778) on Stack Overflow (original [here](http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html)). This works fine in Firefox. In Chrome, there are points inside the polygon which the script says are not inside it.
In Firefox:

In Chrome (the island is different because they are randomly generated):

Please take a look at the source here, particularly the pointPolygonIntersect function:
[Point in Polygon Hit Test](http://www.matthewhollett.com/code/wonder-v1/chromebug.php)
Can anyone figure out why this is happening? The original script is in C, and I am using a JavaScript version - could this be causing the problem?
|
Point in Polygon Hit Test in JavaScript (Chrome bug)
|
CC BY-SA 3.0
| 0 |
2011-06-29T23:43:11.317
|
2011-06-30T02:43:17.180
|
2017-05-23T12:19:48.617
| -1 | 294,189 |
[
"javascript",
"jquery",
"firefox",
"google-chrome",
"point-in-polygon"
] |
6,528,525 | 1 | null | null | 0 | 1,378 |
I have a bizzare issue, I have a DIV that scrolls inside my page... But within that div I have 'header' that is FIXED.... and because my layout is fluid (100%) wide,it is making the "FXED" div cover over the scrollbars of the div below....
What is the best way to fix this? I have attached a simple screenshot of what's going on... hope it helps. 
```
/* BLUE SECTION */
.floatingHeaderBox {
width: 100%;
}
/* RED BOX BELOW */
.contentBoxRight{
position:absolute;
width:80%;
left:20%;
height:100%;
background-color:#FFF;
border-left:1px solid #CCC;
margin-left:-1px;
}
.contentBoxRight{ overflow:auto; overflow-x:hidden; }
```
|
Fixed Div is hidding Scroll bars
|
CC BY-SA 3.0
| null |
2011-06-29T23:45:17.183
|
2013-02-27T20:26:02.753
|
2011-06-29T23:59:36.867
| 679,601 | 679,601 |
[
"css",
"scrollbars"
] |
6,528,552 | 1 | null | null | 1 | 1,284 |
I have a C# 3.5 WinForm project, and I can't find where to adjust Margin used for a DataGridView's Header AutoSize.
AutoSizeColumnsMode is set to None.
I can resize the column larger or smaller, then double click to AutoResize, and it pops to this width, using the margin illustrated by my awesome paint skills:

How can I adjust the margin used?
|
C# WinForm 3.5 DataGridView Column Autosize Margin
|
CC BY-SA 3.0
| null |
2011-06-29T23:49:13.633
|
2012-05-14T00:45:21.370
| null | null | 672,110 |
[
"c#",
"winforms",
"datagridview",
"autosize"
] |
6,528,798 | 1 | 6,530,538 | null | 8 | 1,502 |
Any one knows a tool to find difference between 2 notebooks at the source level?
The compare notebooks tool in workbench 2 seems to work at the internal data structure level which is not useful for me. I am looking for tool that looks at differences at the source level (what one sees when looking at a notebook, i.e. not the FullForm).
I am using V8 of Mathematica on windows.
EDIT1:
How I display the output/report from NotebookDiff in a more readable form?

|
How to diff 2 notebooks at the source level?
|
CC BY-SA 3.0
| 0 |
2011-06-30T00:29:12.707
|
2011-06-30T06:22:15.750
|
2011-06-30T02:41:51.870
| 765,271 | 765,271 |
[
"wolfram-mathematica"
] |
6,528,906 | 1 | 6,529,119 | null | 18 | 30,819 |
Here's the query:
```
SELECT top 100 a.LocationId, b.SearchQuery, b.SearchRank
FROM dbo.Locations a
INNER JOIN dbo.LocationCache b ON a.LocationId = b.LocationId
WHERE a.CountryId = 2
AND a.Type = 7
```
PK_Locations:
> LocationId
IX_Locations_CountryId_Type:
> CountryId, Type
PK_LocationCache:
> LocationId
IX_LocationCache_LocationId_SearchQuery_SearchRank:
> LocationId, SearchQuery, SearchRank

So it's doing a on Locations, using the covering index, cool.
But why it is doing a on the LocationCache covering index?
That covering index has LocationId, SearchQuery, SearchRank in the index (not as "Included columns").
Hover on the index scan:

This query needs to go in an indexed view served by a SQL Server FTS catalogue, consumed by an autocomplete plugin, so it needs to be 100% optimized.
At the moment that above query is taking 3 seconds. It should be < 0.
Any ideas?
|
Why is this an Index Scan and not a Index Seek?
|
CC BY-SA 3.0
| 0 |
2011-06-30T00:51:21.893
|
2015-07-07T08:09:32.557
| null | null | 321,946 |
[
"performance",
"tsql",
"sql-server-2008",
"indexing",
"sql-execution-plan"
] |
6,529,348 | 1 | 6,529,513 | null | 3 | 671 |
i am currently having trouble with my object rotating to face another object.currently it works fine as in this picture, my object at the origin will be able to rotate and move to the object in the 3 quadrants except the quadrant with positive 90degrees to 180 degrees, my object will rotate a few full rotation for some time while moving to the object does anyone know why? the sentence that i use to rotate is `rotation += (foodLocationDegrees - (rotation - 90)) * .2;` whereby food is calculated using
```
var angle:Number = Math.atan2(foodTarget.y - y, foodTarget.x - x);
foodLocationDegrees =Math.floor((angle * 180 / Math.PI));
```
y and x being the object which is a fish, and foodtarget being a object of a food.

```
public function moveToFood():void
{
var dx:Number = x - _destinationX;
var dy:Number = y - _destinationY;
trace("Food location degree relative to fish mouth "+foodLocationDegrees);
var targetRotation:Number = 0;
if (foodLocationDegrees > 0 && foodLocationDegrees < 90)
{
trace("food is on 1st quadrant of the fish mount");
this.x -= dx / 18;
this.y -= dy / 18;
}else if (foodLocationDegrees > 90 && foodLocationDegrees < 180)
{
trace("food is on 2nd quadrant of the fish mount");
this.x -= dx / 18;
this.y -= dy / 18;
}else if (foodLocationDegrees > -180 && foodLocationDegrees < -90)
{
trace("food is on 3nd quadrant of the fish mount");
this.x -= dx / 18;
this.y -= dy / 18;
}else if (foodLocationDegrees < 0 && foodLocationDegrees > -90)
{
trace("food is on 4nd quadrant of the fish mount");
this.x -= dx / 18;
this.y -= dy / 18;
}
trace("Before adding Rotation " + rotation);
var number:Number = (foodLocationDegrees - (rotation - 90)) * .1;
trace("rotation to add "+number);
rotation += (foodLocationDegrees - (rotation - 90)) * .2;
trace("After adding Rotation " + rotation);
//removing food when both hit boxes hit
if (hit.hitTestObject(foodTarget.hit))
{
foodInPond--;
foodTarget.removeSelf();
}
}
```
|
Adobe Flash cs4 rotation math
|
CC BY-SA 3.0
| null |
2011-06-30T02:24:10.563
|
2011-06-30T04:05:11.587
|
2011-06-30T02:43:26.060
| 267,738 | 267,738 |
[
"flash",
"actionscript-3",
"math",
"flash-cs4"
] |
6,529,421 | 1 | null | null | 28 | 84,527 |
I have a div called header that is set up with a fixed position. The problem is when I scroll the page the content of the page shows up behind the header (the header is transparent).
I know a lot about css, but cannot seem to figure this one out. I have tried setting overflow to hidden, but I knew it wouldn't work (and it didn't).
This is very hard to explain, so I did the best I could.
html:
```
<div id="header">
<div id="topmenu">Home | Find Feeds | Subscriptions</div>
</div>
<div id="container">
<div id="content">
testing
</div>
</div>
```
css:
```
#header {
margin:0 auto;
position: fixed;
width:100%;
z-index:1000;
}
#topmenu {
background-color:#0000FF;
height:24px;
filter: alpha(opacity=50);
opacity: 0.5;
}
#leftlinks {
padding: 4px;
padding-left: 10px;
float: left;
}
#rightlinks {
padding: 4px;
padding-right: 10px;
float: right;
}
#containerfixedtop {
width: 100%;
height: 20px;
}
#contentfixedtop {
margin: 0 auto;
background-color: #DAA520;
width: 960px;
height:20px;
}
#container {
position: relative;
top: 68px;
width: 100%;
height: 2000px;
overflow: auto;
}
#content {
margin: 0 auto;
background-color: #DAA520;
width: 960px;
height: 2000px;
}
```
Here's a screenshot of the problem:

|
Hide scrollable content behind transparent fixed position divs when scrolling the page?
|
CC BY-SA 3.0
| 0 |
2011-06-30T02:38:41.417
|
2022-11-21T20:14:02.010
|
2017-04-17T22:50:32.123
| 779,600 | 753,236 |
[
"css",
"position",
"fixed"
] |
6,529,512 | 1 | 6,529,573 | null | 0 | 134 |
I've got a data set that looks as follows:

The first column is an auto-increment primary key. The second column is an ID number for whatever, maybe 3 rocks with IDs 1, 2 and 3 respectively. (I probably should have used the standard customer and order example but oh well.) The third column is a date when I threw the rock. I track the date each time the rock is thrown, hence the multiple IDs (the second column) each with a throwing time.
I want a query to return the rock ID and most recent date for each ID. The result of course would have a single record for each ID - the one with the latest access time.
I'm struggling with the possible combination of "DISTINCT", "TOP 1" and "GROUP BY" clauses that gives the result I want.
|
How do I find the most recently dated record for each ID in a set of IDs where any ID can have multiple records each for a particular date?
|
CC BY-SA 3.0
| null |
2011-06-30T02:53:16.767
|
2011-06-30T07:32:24.917
|
2011-06-30T02:57:23.540
| 135,152 | 133,247 |
[
"sql"
] |
6,529,769 | 1 | 7,312,443 | null | 2 | 4,916 |
When the list underlying my databound DXGrid is updated, the scrollbar of the grid updates but the body of the grid does not, at least not right away. As soon as I click on the grid scrollbar, the body does refresh.
To illustrate - here is my application in the initial state:

When I add four new objects to my underlying list, only the scrollbar changes:

Finally, when I press on the "down" button at the bottom of the scrollbar, the entire grid refreshes:

Expected behaviour: The grid should refresh properly whenever the underlying database list is updated, not much later when the user tries to interact with the list.
The Xaml for my GridControl looks like this:
```
<dxg:GridControl dxlc:DockLayoutControl.Dock="Client"
ItemsSource="{Binding Project.TimeSeries}">
<dxg:GridControl.Columns>
... omitted ...
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView Name="tableView1"
AllowEditing="False"
AllowColumnFiltering="True"
ShowAutoFilterRow="True"
ShowGroupPanel="False"
FocusedRow="{Binding SelectedTimeSeries, Mode=TwoWay}"/>
</dxg:GridControl.View>
</dxg:GridControl>
```
`DataContext` of the form is set to a `TimeSeriesPresenter`:
```
public class TimeSeriesPresenter : ITimeSeriesPresenter
{
public TimeSeriesPresenter(ITimeSeriesVisual view)
: base(view) { ... }
public BuilderProject Project
{ get { ... } set { ... } }
public TimeSeriesDefinition SelectedTimeSeries
{ get { ... } set { ... } }
```
and a `BuilderProject` looks like this:
```
public class BuilderProject : ViewModelBase
{
public IList<TimeSeriesDefinition> TimeSeries
{ get { ... } }
...
}
```
Both of these objects implement `INotifyPropertyChanged` and the properties are triggering the `PropertyChanged` event properly. So, everything just work, right?
Clearly the DXGrid is receiving some kind of update from the view model, because the scrollbar changes. But why doesn't it repaint entirely?
Is there some kind of "mode" required for a DXGrid to do DataBinding normally?
What am I missing?
### Update
All of my data objects inherit from `ViewModelBase` which implements the `INotifyPropertyChanged` interface. In addition to `TimeSeriesPresenter` and `BuilderProject` (shown above), here's a summary of `TimeSeriesDefinition`:
```
public class TimeSeriesDefinition : ViewModelBase
{
public string SeriesID
{
get { return mSeries; }
set {
if (!Equals(mSeries, value) {
mSeries = value;
OnPropertyChanged("SeriesID");
}
}
}
... etc ...
}
```
|
How to make a DXGrid control properly update when DataBound
|
CC BY-SA 3.0
| null |
2011-06-30T03:52:51.210
|
2011-09-05T20:22:19.013
|
2011-06-30T21:34:45.790
| 30,280 | 30,280 |
[
"wpf",
"mvvm",
"devexpress"
] |
6,529,845 | 1 | 6,530,591 | null | 2 | 510 |
I am attempting to draw radials from the center of an ellipse in quartz.
```
CGContextSetRGBStrokeColor(ctx, 0.0, 1.0, 1.0, 1.0); //cyan stroke
CGContextSetLineWidth(ctx, 2.0);
CGContextFillEllipseInRect(ctx, oRect);
CGContextSaveGState(ctx);
CGPoint center = CGPointMake(CGRectGetMidX(oRect), CGRectGetMidY(oRect));
CGFloat maxX = CGRectGetMaxX(oRect);
for(int i = 0; i < 5; i++) {
CGContextBeginPath(ctx);
CGContextMoveToPoint(ctx, maxX, center.y);
CGContextAddLineToPoint(ctx, center.x, center.y);
CGContextClosePath(ctx);
CGContextStrokePath(ctx);
CGContextRotateCTM(ctx, degreesToRadians(5.0));
}
CGContextRestoreGState(ctx);
```
Result:

Instead of the line drawing emanating from the center of the ellipse, it shifts with each transformation of the matrix. Why is the center reset instead of rotated?
|
Draw Radials from center of ellipse in Quartz
|
CC BY-SA 3.0
| 0 |
2011-06-30T04:09:58.997
|
2011-07-01T04:55:38.543
| null | null | 176,817 |
[
"iphone",
"objective-c",
"ipad",
"quartz-2d",
"cgcontext"
] |
6,530,028 | 1 | 6,530,066 | null | 0 | 3,505 |
My page is having left side menu and right side content with links.
When the links in the content are clicked then i need an iframe loading the content in the link and come up so that it covers the right side div having the content.
This iframe should be minimized when not needed and should be visible like a bar at the bottom always floating and when reached bottom of page it should be visible above the footer bar.
Can anyone suggest me how to do this. If example is provided that will be much better.
Thanks,
Sandeep
Im attaching a demo layout of what i wanted.

|
jquery - sliding iframe hiding a div
|
CC BY-SA 3.0
| null |
2011-06-30T04:42:47.590
|
2011-06-30T18:40:51.000
| null | null | 632,173 |
[
"javascript",
"jquery",
"html",
"css",
"iframe"
] |
6,530,045 | 1 | null | null | 3 | 1,042 |
Starting Tomcat with the following JVM options on Linux (2cpu, 4g RAM, 800M ehcache element):
```
-Xmn512m
-Xmx2g
-Xms2g
-XX:+UseConcMarkSweepGC
-Xss128k
-XX:PermSize=64m
-XX:MaxPermSize=128m
-XX:+DisableExplicitGC
-XX:+PrintGCTimeStamps
-XX:+PrintGCDetails
```
Running with low traffic, no db problems and no batch process in the early morning (06:00) for 20 minutes before `-Xmx` before eventually returning to normal GC behavior at which time the message `Unloading class sun.reflect.GeneratedMethodAccessorXXXXX` was printed to the log.
Please could you:
1. Suggest some GC tuning points? or
2. Suggest a possible cause?

GC log:
```
2011-06-30T06:15:03.494+0900: 145634.229: [GC 145634.230: [ParNew: 463698K->37791K(471872K), 0.0342030 secs] 1848117K->1434326K(2044736K), 0.0343190 secs] [Times: user=0.13 sys=0.01, real=0.03 secs]
2011-06-30T06:15:12.423+0900: 145643.159: [GC 145643.159: [ParNew: 457247K->36210K(471872K), 0.0302130 secs] 1853782K->1443540K(2044736K), 0.0303470 secs] [Times: user=0.12 sys=0.00, real=0.03 secs]
2011-06-30T06:15:29.984+0900: 145660.720: [GC 145660.720: [ParNew: 455534K->50720K(471872K), 0.0314960 secs] 1862864K->1458051K(2044736K), 0.0316210 secs] [Times: user=0.12 sys=0.00, real=0.04 secs]
2011-06-30T06:15:46.756+0900: 145677.492: [GC 145677.492: [ParNew: 470176K->52416K(471872K), 0.0446300 secs] 1877507K->1477425K(2044736K), 0.0447580 secs] [Times: user=0.17 sys=0.01, real=0.05 secs]
2011-06-30T06:16:06.400+0900: 145697.135: [GC 145697.136: [ParNew: 471872K->35652K(471872K), 0.0451560 secs] 1896881K->1480786K(2044736K), 0.0452730 secs] [Times: user=0.16 sys=0.00, real=0.04 secs]
2011-06-30T06:16:23.468+0900: 145714.204: [GC 145714.204: [ParNew: 455108K->38442K(471872K), 0.0356610 secs] 1900242K->1498930K(2044736K), 0.0357770 secs] [Times: user=0.13 sys=0.00, real=0.04 secs]
2011-06-30T06:16:23.505+0900: 145714.240: [GC [1 CMS-initial-mark: 1460487K(1572864K)] 1499562K(2044736K), 0.0099200 secs] [Times: user=0.01 sys=0.00, real=0.01 secs]
2011-06-30T06:16:23.515+0900: 145714.251: [CMS-concurrent-mark-start]
2011-06-30T06:16:24.768+0900: 145715.504: [CMS-concurrent-mark: 1.253/1.253 secs] [Times: user=1.31 sys=0.00, real=1.25 secs]
2011-06-30T06:16:24.768+0900: 145715.504: [CMS-concurrent-preclean-start]
2011-06-30T06:16:24.775+0900: 145715.511: [CMS-concurrent-preclean: 0.007/0.007 secs] [Times: user=0.00 sys=0.01, real=0.01 secs]
2011-06-30T06:16:24.775+0900: 145715.511: [CMS-concurrent-abortable-preclean-start]
CMS: abort preclean due to time 2011-06-30T06:16:29.811+0900: 145720.547: [CMS-concurrent-abortable-preclean: 0.760/5.036 secs] [Times: user=1.02 sys=0.02, real=5.03 secs]
2011-06-30T06:16:29.812+0900: 145720.547: [GC[YG occupancy: 197582 K (471872 K)]145720.547: [Rescan (parallel) , 0.0291550 secs]145720.577: [weak refs processing, 0.0005100 secs]145720.577: [class unloading, 0.0349910 secs]145720.612: [scrub symbol & string tables, 0.0054610 secs] [1 CMS-remark: 1460487K(1572864K)] 1658070K(2044736K), 0.0776190 secs] [Times: user=0.16 sys=0.00, real=0.08 secs]
2011-06-30T06:16:29.889+0900: 145720.625: [CMS-concurrent-sweep-start]
2011-06-30T06:16:30.381+0900: 145721.117: [CMS-concurrent-sweep: 0.491/0.492 secs] [Times: user=0.55 sys=0.00, real=0.49 secs]
2011-06-30T06:16:30.381+0900: 145721.117: [CMS-concurrent-reset-start]
2011-06-30T06:16:30.394+0900: 145721.130: [CMS-concurrent-reset: 0.012/0.012 secs] [Times: user=0.01 sys=0.00, real=0.02 secs]
2011-06-30T06:16:40.537+0900: 145731.273: [GC 145731.273: [ParNew: 457898K->45230K(471872K), 0.0274660 secs] 1896984K->1484315K(2044736K), 0.0275880 secs] [Times: user=0.11 sys=0.00, real=0.03 secs]
2011-06-30T06:16:57.459+0900: 145748.194: [GC 145748.194: [ParNew: 464686K->52416K(471872K), 0.0387420 secs] 1903771K->1505124K(2044736K), 0.0388710 secs] [Times: user=0.14 sys=0.01, real=0.04 secs]
2011-06-30T06:16:57.500+0900: 145748.235: [GC [1 CMS-initial-mark: 1452708K(1572864K)] 1506926K(2044736K), 0.0130330 secs] [Times: user=0.01 sys=0.00, real=0.01 secs]
2011-06-30T06:16:57.513+0900: 145748.249: [CMS-concurrent-mark-start]
2011-06-30T06:16:58.777+0900: 145749.513: [CMS-concurrent-mark: 1.265/1.265 secs] [Times: user=1.37 sys=0.01, real=1.27 secs]
2011-06-30T06:16:58.778+0900: 145749.513: [CMS-concurrent-preclean-start]
2011-06-30T06:16:58.787+0900: 145749.523: [CMS-concurrent-preclean: 0.008/0.009 secs] [Times: user=0.02 sys=0.00, real=0.00 secs]
2011-06-30T06:16:58.787+0900: 145749.523: [CMS-concurrent-abortable-preclean-start]
CMS: abort preclean due to time 2011-06-30T06:17:03.905+0900: 145754.641: [CMS-concurrent-abortable-preclean: 1.033/5.118 secs] [Times: user=1.40 sys=0.05, real=5.12 secs]
2011-06-30T06:17:03.906+0900: 145754.642: [GC[YG occupancy: 301453 K (471872 K)]145754.642: [Rescan (parallel) , 0.1761440 secs]145754.818: [weak refs processing, 0.0000280 secs]145754.818: [class unloading, 0.0270100 secs]145754.845: [scrub symbol & string tables, 0.0043090 secs] [1 CMS-remark: 1452708K(1572864K)] 1754161K(2044736K), 0.2132540 secs] [Times: user=0.23 sys=0.00, real=0.22 secs]
2011-06-30T06:17:04.120+0900: 145754.855: [CMS-concurrent-sweep-start]
2011-06-30T06:17:04.595+0900: 145755.331: [CMS-concurrent-sweep: 0.475/0.475 secs] [Times: user=0.50 sys=0.01, real=0.47 secs]
2011-06-30T06:17:04.595+0900: 145755.331: [CMS-concurrent-reset-start]
2011-06-30T06:17:04.607+0900: 145755.343: [CMS-concurrent-reset: 0.012/0.012 secs] [Times: user=0.01 sys=0.00, real=0.01 secs]
2011-06-30T06:17:05.951+0900: 145756.687: [GC [1 CMS-initial-mark: 1449550K(1572864K)] 1792244K(2044736K), 0.1979100 secs] [Times: user=0.20 sys=0.00, real=0.20 secs]
2011-06-30T06:17:06.149+0900: 145756.885: [CMS-concurrent-mark-start]
2011-06-30T06:17:07.408+0900: 145758.144: [CMS-concurrent-mark: 1.259/1.259 secs] [Times: user=1.30 sys=0.01, real=1.26 secs]
2011-06-30T06:17:07.408+0900: 145758.144: [CMS-concurrent-preclean-start]
2011-06-30T06:17:07.417+0900: 145758.153: [CMS-concurrent-preclean: 0.008/0.009 secs] [Times: user=0.01 sys=0.00, real=0.00 secs]
2011-06-30T06:17:07.418+0900: 145758.153: [CMS-concurrent-abortable-preclean-start]
2011-06-30T06:17:10.528+0900: 145761.264: [GC 145761.264: [ParNew: 471872K->47677K(471872K), 0.0412690 secs] 1921422K->1507670K(2044736K), 0.0413820 secs] [Times: user=0.13 sys=0.00, real=0.05 secs]
CMS: abort preclean due to time 2011-06-30T06:17:12.459+0900: 145763.195: [CMS-concurrent-abortable-preclean: 0.974/5.041 secs] [Times: user=1.55 sys=0.05, real=5.04 secs]
2011-06-30T06:17:12.460+0900: 145763.195: [GC[YG occupancy: 110735 K (471872 K)]145763.195: [Rescan (parallel) , 0.0157680 secs]145763.211: [weak refs processing, 0.0000140 secs]145763.211: [class unloading, 0.0140640 secs]145763.225: [scrub symbol & string tables, 0.0042960 secs] [1 CMS-remark: 1459992K(1572864K)] 1570728K(2044736K), 0.0399100 secs] [Times: user=0.08 sys=0.00, real=0.04 secs]
2011-06-30T06:17:12.503+0900: 145763.238: [CMS-concurrent-sweep-start]
2011-06-30T06:17:12.967+0900: 145763.703: [CMS-concurrent-sweep: 0.463/0.464 secs] [Times: user=0.58 sys=0.01, real=0.46 secs]
2011-06-30T06:17:12.967+0900: 145763.703: [CMS-concurrent-reset-start]
2011-06-30T06:17:12.980+0900: 145763.716: [CMS-concurrent-reset: 0.013/0.013 secs] [Times: user=0.01 sys=0.00, real=0.02 secs]
2011-06-30T06:17:13.222+0900: 145763.957: [GC [1 CMS-initial-mark: 1459706K(1572864K)] 1645309K(2044736K), 0.0994390 secs] [Times: user=0.10 sys=0.00, real=0.10 secs]
2011-06-30T06:17:13.321+0900: 145764.057: [CMS-concurrent-mark-start]
2011-06-30T06:17:14.589+0900: 145765.324: [CMS-concurrent-mark: 1.267/1.267 secs] [Times: user=1.37 sys=0.00, real=1.26 secs]
2011-06-30T06:17:14.589+0900: 145765.324: [CMS-concurrent-preclean-start]
2011-06-30T06:17:14.600+0900: 145765.336: [CMS-concurrent-preclean: 0.010/0.011 secs] [Times: user=0.01 sys=0.01, real=0.02 secs]
2011-06-30T06:17:14.600+0900: 145765.336: [CMS-concurrent-abortable-preclean-start]
CMS: abort preclean due to time 2011-06-30T06:17:19.697+0900: 145770.433: [CMS-concurrent-abortable-preclean: 1.015/5.097 secs] [Times: user=1.38 sys=0.04, real=5.09 secs]
2011-06-30T06:17:19.697+0900: 145770.433: [GC[YG occupancy: 422112 K (471872 K)]145770.433: [Rescan (parallel) , 0.2029540 secs]145770.636: [weak refs processing, 0.0000600 secs]145770.636: [class unloading, 0.0140870 secs]145770.650: [scrub symbol & string tables, 0.0042890 secs] [1 CMS-remark: 1459706K(1572864K)] 1881819K(2044736K), 0.2271390 secs] [Times: user=0.24 sys=0.00, real=0.23 secs]
2011-06-30T06:17:19.925+0900: 145770.661: [CMS-concurrent-sweep-start]
2011-06-30T06:17:20.284+0900: 145771.019: [GC 145771.019: [ParNew: 467133K->38523K(471872K), 0.0340350 secs] 1925973K->1507043K(2044736K), 0.0341500 secs] [Times: user=0.11 sys=0.00, real=0.03 secs]
2011-06-30T06:17:20.443+0900: 145771.178: [CMS-concurrent-sweep: 0.479/0.518 secs] [Times: user=0.73 sys=0.01, real=0.52 secs]
2011-06-30T06:17:20.443+0900: 145771.178: [CMS-concurrent-reset-start]
2011-06-30T06:17:20.455+0900: 145771.191: [CMS-concurrent-reset: 0.013/0.013 secs] [Times: user=0.01 sys=0.00, real=0.01 secs]
2011-06-30T06:17:22.458+0900: 145773.194: [GC [1 CMS-initial-mark: 1468355K(1572864K)] 1663164K(2044736K), 0.1190060 secs] [Times: user=0.12 sys=0.00, real=0.12 secs]
2011-06-30T06:17:22.577+0900: 145773.313: [CMS-concurrent-mark-start]
2011-06-30T06:17:23.856+0900: 145774.592: [CMS-concurrent-mark: 1.278/1.279 secs] [Times: user=1.40 sys=0.01, real=1.28 secs]
2011-06-30T06:17:23.856+0900: 145774.592: [CMS-concurrent-preclean-start]
2011-06-30T06:17:23.870+0900: 145774.606: [CMS-concurrent-preclean: 0.012/0.014 secs] [Times: user=0.01 sys=0.00, real=0.02 secs]
2011-06-30T06:17:23.870+0900: 145774.606: [CMS-concurrent-abortable-preclean-start]
CMS: abort preclean due to time 2011-06-30T06:17:28.933+0900: 145779.669: [CMS-concurrent-abortable-preclean: 0.780/5.063 secs] [Times: user=0.89 sys=0.02, real=5.06 secs]
2011-06-30T06:17:28.934+0900: 145779.669: [GC[YG occupancy: 327483 K (471872 K)]145779.669: [Rescan (parallel) , 0.1466580 secs]145779.816: [weak refs processing, 0.0000240 secs]145779.816: [class unloading, 0.0144090 secs]145779.831: [scrub symbol & string tables, 0.0043100 secs] [1 CMS-remark: 1468355K(1572864K)] 1795838K(2044736K), 0.1711490 secs] [Times: user=0.18 sys=0.00, real=0.17 secs]
2011-06-30T06:17:29.105+0900: 145779.841: [CMS-concurrent-sweep-start]
2011-06-30T06:17:29.592+0900: 145780.328: [CMS-concurrent-sweep: 0.487/0.487 secs] [Times: user=0.57 sys=0.01, real=0.49 secs]
2011-06-30T06:17:29.592+0900: 145780.328: [CMS-concurrent-reset-start]
2011-06-30T06:17:29.605+0900: 145780.340: [CMS-concurrent-reset: 0.012/0.012 secs] [Times: user=0.01 sys=0.00, real=0.01 secs]
2011-06-30T06:17:31.607+0900: 145782.343: [GC [1 CMS-initial-mark: 1467716K(1572864K)] 1875108K(2044736K), 0.2378610 secs] [Times: user=0.24 sys=0.00, real=0.24 secs]
2011-06-30T06:17:31.845+0900: 145782.581: [CMS-concurrent-mark-start]
2011-06-30T06:17:33.124+0900: 145783.860: [CMS-concurrent-mark: 1.279/1.279 secs] [Times: user=1.38 sys=0.01, real=1.28 secs]
2011-06-30T06:17:33.124+0900: 145783.860: [CMS-concurrent-preclean-start]
2011-06-30T06:17:33.136+0900: 145783.872: [CMS-concurrent-preclean: 0.011/0.012 secs] [Times: user=0.01 sys=0.00, real=0.01 secs]
2011-06-30T06:17:33.136+0900: 145783.872: [CMS-concurrent-abortable-preclean-start]
2011-06-30T06:17:33.278+0900: 145784.014: [GC 145784.014: [ParNew: 457979K->34427K(471872K), 0.0331350 secs] 1925695K->1513373K(2044736K), 0.0332490 secs] [Times: user=0.12 sys=0.00, real=0.03 secs]
CMS: abort preclean due to time 2011-06-30T06:17:38.148+0900: 145788.884: [CMS-concurrent-abortable-preclean: 1.020/5.012 secs] [Times: user=1.60 sys=0.07, real=5.01 secs]
2011-06-30T06:17:38.149+0900: 145788.885: [GC[YG occupancy: 225806 K (471872 K)]145788.885: [Rescan (parallel) , 0.0359240 secs]145788.921: [weak refs processing, 0.0000080 secs]145788.921: [class unloading, 0.0141010 secs]145788.935: [scrub symbol & string tables, 0.0042870 secs] [1 CMS-remark: 1478946K(1572864K)] 1704752K(2044736K), 0.0600530 secs] [Times: user=0.15 sys=0.01, real=0.06 secs]
2011-06-30T06:17:38.209+0900: 145788.945: [CMS-concurrent-sweep-start]
2011-06-30T06:17:38.677+0900: 145789.413: [CMS-concurrent-sweep: 0.468/0.468 secs] [Times: user=0.50 sys=0.00, real=0.47 secs]
2011-06-30T06:17:38.677+0900: 145789.413: [CMS-concurrent-reset-start]
2011-06-30T06:17:38.689+0900: 145789.425: [CMS-concurrent-reset: 0.012/0.012 secs] [Times: user=0.01 sys=0.00, real=0.01 secs]
2011-06-30T06:17:40.692+0900: 145791.428: [GC [1 CMS-initial-mark: 1478750K(1572864K)] 1772006K(2044736K), 0.1637570 secs] [Times: user=0.17 sys=0.00, real=0.17 secs]
2011-06-30T06:17:40.856+0900: 145791.591: [CMS-concurrent-mark-start]
2011-06-30T06:17:42.142+0900: 145792.878: [CMS-concurrent-mark: 1.285/1.286 secs] [Times: user=1.46 sys=0.02, real=1.28 secs]
2011-06-30T06:17:42.142+0900: 145792.878: [CMS-concurrent-preclean-start]
2011-06-30T06:17:42.154+0900: 145792.890: [CMS-concurrent-preclean: 0.010/0.012 secs] [Times: user=0.01 sys=0.00, real=0.02 secs]
2011-06-30T06:17:42.154+0900: 145792.890: [CMS-concurrent-abortable-preclean-start]
2011-06-30T06:17:44.003+0900: 145794.739: [GC 145794.739: [ParNew: 453806K->49194K(471872K), 0.0277970 secs] 1932556K->1527945K(2044736K), 0.0279130 secs] [Times: user=0.10 sys=0.00, real=0.02 secs]
CMS Log .....
CMS Log .....
CMS Log .....
...
normal gc log....
```
|
Successive CMS collections using ConcMarkSweepGC
|
CC BY-SA 3.0
| 0 |
2011-06-30T04:47:09.760
|
2021-07-29T14:58:48.513
|
2021-07-29T14:58:48.513
| 5,459,839 | 174,140 |
[
"java",
"memory",
"garbage-collection",
"jvm",
"heap-memory"
] |
6,530,247 | 1 | 6,534,244 | null | 0 | 367 |
I am developing an application in which I have to show the selected time in my clock image.
Description:-
What I exactly want to say it I am having a image of circle. Now according to the selected time I want that portion to be filled in some other color on my circle image.
Please help me in doing this.
I am stuck here.
I have attached the image that will describe more what I exactly want to do.
I also tried it with doing it with pie-chart but area showing not giving proper time.
Please please help me.

In this image it shows time 1:am to 6:am
Any help would be highly appreciated.
|
Using Core Plot to show the selected Time Period in circle
|
CC BY-SA 3.0
| null |
2011-06-30T05:20:50.423
|
2011-06-30T11:48:48.793
|
2011-06-30T07:28:44.123
| 30,461 | 633,676 |
[
"iphone",
"objective-c",
"core-graphics",
"core-plot",
"cppiechart"
] |
6,530,323 | 1 | 6,530,555 | null | 0 | 1,130 |
I am using excel 2010 and retrieving data from SQL analysis service.
When I refresh the data from excel , rows become dynamics as it is bind to external datasource. I am adding a seperate columns with formula for summing total amount.
With increment or decrement of rows in excel , alignment of custom columns goes out.
How can I resolve this problem that summing of values become dynamic with adding and removal of rows ?
How to write a macro for doing this task ?
This what i am trying , but i am getting the following error :
```
Public Sub ProcessData()
Dim i As Long
Dim iLastRow As Long
Dim iStart As Long
With Sheet1
iLastRow = .Cells(.Rows.Count, "D").End(xlUp).Row
iStart = 5
For i = 1 To iLastRow + 1
If .Cells(i, "C").Value <> "" And .Cells(i, "B").Value <> "" Then
.Cells(i, "D").Value =
Application.Sum(.Range(.Cells(iStart, "C").Value + .Cells ( iStart, "B").Value))
iStart = i + 1
End If
Next i
End With
End Sub
```

|
how to write macro for summing for dynamic rows
|
CC BY-SA 3.0
| null |
2011-06-30T05:30:47.573
|
2011-06-30T06:03:21.637
|
2020-06-20T09:12:55.060
| -1 | 389,288 |
[
"vba",
"excel"
] |
6,530,340 | 1 | 6,537,268 | null | 8 | 3,348 |
Given the following contrived example:

I would like to query my data for all objects that are either cats or dogs. I want the result set ordered by name regardless of species, so fetching all cats then fetching all dogs won't do. I want to do this in a single query.
One way to do this would be to add a petType field to Pet, give every record a petType value that identifies the sub-entity it belongs to, then query like so:
```
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Pet"
inManagedObjectContext:myMOC];
[fetchRequest setEntity:entity];
// petType values: 1 = dog, 2 = cat, 3 = goldfish. Yuk.
NSPredicate *p = [NSPredicate predicateWithFormat:@"petType = 1 OR petType = 2"]
[fetchRequest setPredicate:p];
// etc...
```
But the mere thought of doing it that way makes me shudder. Is there a better way?
---
: Thanks to all those who've replied - there are some really good, well-thought out solutions here and I appreciate all of them.
To give this some context, the real data model is a little more complex than this (aren't they always), but it's pretty well organised. I've designed more than my fair share of data schemas in my time and I'm happy that the entities and their relationships are well considered. This issue has come about because (to extend the already shaky contrived example) the client originally wanted:
- - - -
So far, so good. But they also want a view showing a combined list of all cats and dogs "because little girls like cats and dogs". (Initially it was cats and goldfish, for the same reason.) There isn't really a way to naturally group that subset of the concrete entities; it's really rather arbitrary.
So far, Dave Dribin's "abstract intermediate entity" approach seems like the cleanest solution, although in my case I think it would feel somewhat artificial; really the only way you could truthfully label the intermediate entity would be as "ThingLittleGirlsLike"! :)
|
Querying for all objects of multiple child entity types in Core Data
|
CC BY-SA 3.0
| 0 |
2011-06-30T05:32:26.050
|
2011-06-30T16:47:28.000
|
2011-06-30T16:47:28.000
| 263,871 | 263,871 |
[
"objective-c",
"cocoa",
"core-data"
] |
6,530,397 | 1 | 6,531,776 | null | 6 | 2,629 |
I realize that `ofstream` doesn't work on Windows 7 hidden file.
Here is the quick test code.
```
#include <fstream>
#include <iostream>
#include <tchar.h>
#include <windows.h>
int main() {
{
std::ifstream file2(_T("c:\\a.txt"));
if (file2.is_open()) {
std::cout << "ifstream open" << std::endl;
} else {
std::cout << "ifstream not open!" << std::endl;
}
}
// SetFileAttributes(_T("c:\\a.txt"), FILE_ATTRIBUTE_NORMAL);
SetFileAttributes(_T("c:\\a.txt"), FILE_ATTRIBUTE_HIDDEN);
{
std::ofstream file(_T("c:\\a.txt"));
if (file.is_open()) {
std::cout << "ofstream open" << std::endl;
} else {
std::cout << "ofstream not open!" << std::endl;
}
}
getchar();
}
```
Here is the output I am getting
```
ifstream open
ofstream not open!
```
If I am using `FILE_ATTRIBUTE_NORMAL`, `ofstream` will be opened successfully.
I do not run the program as Administrator. But, I do use the following linker option.

Having to turn for is important, if we do not start the application as Administrator. OS will help us to write the actual file to `C:\Users\yccheok\AppData\Local\VirtualStore\a.txt` instead of protected `C:\`
Does `ofstream` fail on Windows 7 hidden file, is an expected behaviour?
|
ofstream doesn't work on Windows 7 hidden file
|
CC BY-SA 3.0
| 0 |
2011-06-30T05:39:26.360
|
2011-06-30T08:06:06.813
|
2011-06-30T06:02:57.917
| 72,437 | 72,437 |
[
"c++",
"windows-7"
] |
6,530,420 | 1 | 6,530,441 | null | 6 | 13,836 |
>
[How does Facebook Sharer select Images?](https://stackoverflow.com/questions/1138460/how-does-facebook-sharer-select-images)
As the owner of the page being liked, is there anyway to control the url that shows up on the wall of people who like my page?

See the above image? Like a blog post on this page: www.sunlitehardware.com.au and you will note that the "thrifty link" logo, found in the bottom right hand corner of the website, is displayed (as shown in the picture above). I want to change that to a sunlite hardware logo.
|
Control the image that facebook shows when I like a URL
|
CC BY-SA 3.0
| 0 |
2011-06-30T05:43:45.220
|
2011-06-30T05:48:25.993
|
2017-05-23T12:30:37.427
| -1 | 311,465 |
[
"facebook"
] |
6,530,505 | 1 | null | null | 0 | 161 |
`javascript or html ?`i want to add a authentication required box like the netgear routers have ?how can i code my website to do so ? 
|
how to develop my website to show a authentication window(javascript) like the netgear routers show when connected to them..?
|
CC BY-SA 3.0
| null |
2011-06-30T05:57:34.630
|
2011-06-30T06:34:33.813
| null | null | 470,892 |
[
"javascript",
"html"
] |
6,530,518 | 1 | 6,530,651 | null | 7 | 4,586 |
After running Canny edge detector on an image i'm getting clear lines. But the Hough line function seems to be missing out on pretty prominent lines when run on the Canny edgemap image.
I'm keeping only vertical and horizontal Hough lines (a tolerance of 15 degrees). Lots of extra lines are coming up but clearly visible lines bounding the rectangles are not being picked up.
Here's the snippet:
```
cvCanny( img, canny, 0, 100, 3 );
lines = cvHoughLines2( canny, storage, CV_HOUGH_PROBABILISTIC, 1, CV_PI/180, 35, 20, 10 );
```
The main intention is to detect the rectangular boxes that denote the nodes of the linked list. However the squares.c sample program will detect only perfect rectangles, not if an arrowhead is touching the rectangle boundary.
Could you please explain the sort of changes to Hough line function which will help me get hough lines corresponding to clearly visible lines in Canny edge image?

|
Prominent lines not detected by Hough Transform
|
CC BY-SA 3.0
| 0 |
2011-06-30T05:58:35.767
|
2015-05-14T12:54:21.080
| null | null | 297,353 |
[
"visual-c++",
"image-processing",
"opencv",
"computer-vision"
] |
6,530,933 | 1 | null | null | 1 | 306 |
I'm trying to create a WCF data service that exposes a database represented by an entity framework model, and running into a problem running HTTP POST requests against a table with multiple 1-* inheritances.
The entity framework table is as follows:

Most tables with one parent entity can be accessed via POST to the parent URI, i.e., '[http://url/data.svc/parent(id)](http://url/data.svc/parent(id))'. The problem I'm running into is I can't use this method due to the multiple inheritances. I could allow one FK to be nullable, and update with a separate PUT operation, but that's just bad code.
I'm creating the HTTP request using JSON. Here's an example of what I've been trying
```
POST http://url/data.svc/Order_Item HTTP/1.1
User-Agent: Fiddler
Accept: application/json
Content-Type: application/json
{"Count": 2, "Item": {"uri": "http://url/data.svc/Items(ID)"}, "Order": {"uri": "http://url/data.svc/Order(ID)"}}
```
The InitializeService method is as follows:
```
public static void InitializeService(DataServiceConfiguration config)
{
config.SetEntitySetAccessRule("*", EntitySetRights.All);
config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All);
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
}
```
I know that this is probably pretty simple, but could someone help me figure the syntax on posting linked entities? Thank you in advance
|
Creating entries with multiple links in a WCF data services project based on EF model
|
CC BY-SA 3.0
| null |
2011-06-30T06:45:05.597
|
2011-07-01T01:39:38.933
| null | null | 546,666 |
[
"c#",
"entity-framework",
"post",
"wcf-data-services"
] |
6,531,073 | 1 | 6,531,134 | null | 0 | 93 |
```
#include <iostream>
#include <cstring>
using namespace std;
int main() {
char sor[6] = "hello";
char des[6] = "hello";
strcat(des,sor);
cout << des;
}
```
When i start the debugging of the program it gives the following error along with the console output :

If there is anything wrong with the code ,please give a suggestion
|
Is there anything wrong with the program
|
CC BY-SA 3.0
| null |
2011-06-30T07:00:52.657
|
2011-07-01T08:00:45.030
|
2020-06-20T09:12:55.060
| -1 | 648,138 |
[
"c++",
"string",
"visual-c++"
] |
6,531,204 | 1 | 6,951,853 | null | 2 | 2,698 |
i need your help to create a tabcontrol like this :

There is a space in tabpanel from top to selected tab, and there a space too between tabitem and field
and last change the shapes of tab item.
i had learn from some website i get from google but no one i find really help me.
this is one of i get
[WPF Styles for TabControl / TabPanel / TabItem](https://stackoverflow.com/questions/3516841/wpf-styles-for-tabcontrol-tabpanel-tabitem)
|
wpf change tabitem shape and tabpanel space
|
CC BY-SA 3.0
| 0 |
2011-06-30T07:14:14.607
|
2011-08-05T05:32:01.130
|
2017-05-23T12:19:48.617
| -1 | 553,779 |
[
"wpf",
"xaml"
] |
6,531,218 | 1 | null | null | 0 | 1,106 |
I am trying to display the map view in android as such in the google map.But how to get the map with the photos for certain places. Thanks in advance.

|
Google Map view with photos layer in Android
|
CC BY-SA 3.0
| null |
2011-06-30T07:14:56.423
|
2011-06-30T07:21:57.300
| null | null | 504,130 |
[
"android",
"google-maps"
] |
6,531,771 | 1 | 6,532,430 | null | 1 | 5,914 |
see the screen shot is clear to understand what I mean

you can see I add a navigationItem in my pop view
I wish I can dismiss the pop view
But it seems only tab the cell under the pop view
The pop view will dismiss,I try to add this method
```
[self.view removeFromSuperview];
```
It only remove the table view , the pop view frame is still there ,only without the content view
Any reply will be helpful : )
Thanks
Webber
/******EDIT******/
I use [WEPopoverView](http://cocoacontrols.com/platforms/ios/controls/wepopover) into my project
And this is the code I create the pop view when I select the table view
```
if (indexPath.row==2) {
DaysOfWeek *popView = [[DaysOfWeek alloc]init];
UINavigationController *navPopView = [[UINavigationController alloc] initWithRootViewController:popView];
if (self.popoverController) {
[self.popoverController dismissPopoverAnimated:YES];
self.popoverController = nil;
}
else {
self.popoverController = [[[WEPopoverController alloc] initWithContentViewController:navPopView] autorelease];
CGRect frame = [tableView cellForRowAtIndexPath:indexPath].frame;
[self.popoverController presentPopoverFromRect:frame
inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown|UIPopoverArrowDirectionUp
animated:YES];
}
}
```
/******EDIT2******/
I try to add Done button when I create the pop view
here is the code , But it only appear a navigation , no Done button
```
DaysOfWeek *popView = [[DaysOfWeek alloc]init];
UINavigationController *navPopView = [[UINavigationController alloc] initWithRootViewController:popView];
navPopView.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(hidePopView)];
```
|
How to dismiss pop over view in content view?
|
CC BY-SA 3.0
| null |
2011-06-30T08:05:23.130
|
2013-06-18T11:43:32.697
|
2011-07-01T03:38:56.370
| 437,132 | 437,132 |
[
"iphone",
"objective-c",
"ios",
"uipopovercontroller",
"dismiss"
] |
6,531,901 | 1 | null | null | 1 | 299 |
I have to implement a custom toolbar for my application, where a button will be placed on the side of exit, maximize and minimize buttons.
I tried to work with the toolbar element on XCode, but it always put elements below these buttons and not on the side.
App Store application implement this feature, like you can see in this image.

|
How do I build a toolbar in my title bar?
|
CC BY-SA 3.0
| 0 |
2011-06-30T08:16:47.097
|
2011-06-30T09:31:05.453
|
2011-06-30T09:11:13.647
| 30,461 | 812,568 |
[
"cocoa"
] |
6,531,974 | 1 | 6,532,045 | null | 1 | 162 |
I'll show you my problem by image. I have tableView in which i customize the UITableViewCell and tableViewCell having UILabel field. In this UILabel field data is coming by parsing the XML file data come completely but a little alignment problem it looks like a paragraph showing in image given below:-

and this in my code which is used to print data on this UItableViewCell's UILabel:-
```
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"TableCell13" owner:self options:NULL];
cell = nibLoadedCell;
}
titleLabel.text = aNewsInfo.title;
return cell; }
```
and I used Interface Builder (IB) for designing the cell i showing the setting by the image given blow for the UITableView cells UILabel :-

any one suggest me the method how can i rectify this problem.
Thanks in advance
|
UIlabel data is not aligned?
|
CC BY-SA 3.0
| null |
2011-06-30T08:22:46.813
|
2011-06-30T09:11:08.983
|
2011-06-30T09:11:08.983
| 223,633 | 755,278 |
[
"iphone",
"objective-c",
"xcode4"
] |
6,532,222 | 1 | 6,532,328 | null | 13 | 25,460 |
I have a winform application and this winform application has created few files. I want to implement "find target" function in my application to show those files. Those files located in a same folder. See the picture:

Let's say that I have created few files in `"C:\Test\"` folder and this folder has this file: `"C:\Test\File1.txt"`. How to create "find target" functionality using VB.NET?
|
How do I open a windows explorer window with a specific folder selected
|
CC BY-SA 3.0
| 0 |
2011-06-30T08:44:36.143
|
2011-06-30T09:10:53.710
|
2011-06-30T09:10:53.710
| 774,411 | 774,411 |
[
".net",
"vb.net"
] |
6,532,112 | 1 | 6,533,410 | null | 1 | 496 |
whole code download: [http://tunps.com/tmp/UsbAutoCopy.zip](http://tunps.com/tmp/UsbAutoCopy.zip)

here is the WinMain :
```
int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow )
{
DialogBox(hInstance, MAKEINTRESOURCE(IDD_MAIN),
hWnd, DlgProc);
return 0;
}
```
in global scope:
```
typedef struct ArgsTag {
CHAR vol;
HWND hWndDlg;
} Args, *pArgs;
```
in Message loop:
```
pArgs arg;
arg = malloc(sizeof(struct ArgsTag));
arg->vol= FirstDriveFromMask(lpdbv->dbcv_unitmask);
arg->hWndDlg = hWndDlg;
_beginthread ((LPVOID)CopyThread, 0, (LPVOID)arg) ;
```
here is the Dialog procedure function prototype:
```
LRESULT CALLBACK DlgProc(HWND hWndDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
```
get the right `arg->vol` but `arg->hWndDlg` return the wrong address.
`hWndDlg`
```
hLog = GetDlgItem(arg->hWndDlg,IDC_LOG);
```
after google alot, i still find nothing, so how do i get the right hWndDlg child HWND ?
by the way, the size information
`sizeof(args)` = 4
`sizeof(ArgsTag)` = 8
`sizeof(args->vol)` = 1
`sizeof(args->hWndDlg)` = 4
update:2011.07.01
OK, i am insanely mad now on this question.
i would like to post the whole code this, compiles on
It's a usb auto-copy programs, It can detect USB storage device plugged in and copy the designated file path on the USB storage device to the designated directory on hard disk and while show logs on right edit box of the programs.
```
#include <windows.h>
#include <iostream.h>
#include <process.h>
#include <stdio.h>
#include <dbt.h>
#include <Shlobj.h>
#include "resource.h"
#include "Shlwapi.h"
//---------------------------------------------------------------------------
#define _TRACE true;
DEV_BROADCAST_HDR* dhr;
PDEV_BROADCAST_VOLUME lpdbv;
//OPENFILENAME ofn;
BROWSEINFO bi;
LPITEMIDLIST lpItemIdList;
HWND hWnd;
static HICON hIcon,hIconSm;
HANDLE hFile,hFileList,hDstDir,hLog,hBtnSave,hBtnBrowse;
DWORD err,dwWritenSize = 0;
CHAR vol,bufFileList[1024],bufDstDir[MAX_PATH],subStr[1024],buf[1024],buf2[1024],deviceID[1024];
TCHAR szPath[_MAX_PATH];
PCHAR pvol;
LPCTSTR configFileName = "D:\\win32dev\\sdk\\UsbAutoCopy\\Debug\\config.ini";
//LPSTR szPath;
UINT i,len,j=0;k=0;
FILE *stream;
char buflist[1000][1024]={0};
typedef struct ArgsTag {
HWND hWndDlg;
CHAR vol;
} Args, *pArgs;
LRESULT CALLBACK DlgProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
LPTSTR ReadConfigFile(LPTSTR key);
BOOL WriteConfigFile(TCHAR *bufFileList,TCHAR *bufDstDir);
int ReplaceStr(char *sSrc, char *sMatchStr, char *sReplaceStr);
char FirstDriveFromMask (ULONG unitmask); //prototype
void CopyThread(CHAR vol);
char* getFileName(char* dirName);
/************************************************************************/
/* e.g: \1.txt->\1.txt \dir1\dir2\test.exe->\test.exe */
/************************************************************************/
char* getFileName(char* dirName)
{
unsigned int i,j=0;
//buf={0};
for(i=strlen(dirName);i>=0;i--)
{
//fileName[j++] = dirName[i];
if(dirName[i] == '\\')
{
for(j=0;j<strlen(dirName);)
buf[j++] = dirName[i++];
break;
}
}
return buf;
}
void CopyThread(pArgs arg)
{
char temp[1024];
pvol = &(arg->vol);
pvol[1] = 0;
//GetPrivateProfileString("config","DeviceID","",buf,sizeof(buf),strcat(pvol,":\\dp\\device.ini")); 没有section无法读取DeviceID
strcat(pvol,":\\dp\\device.ini");
//hFile = CreateFile(pvol,GENERIC_READ,FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
//ReadFile((HANDLE)hFile,buf,sizeof(buf)/2,&dwWritenSize,NULL);
// get the Device ID
if( (stream = fopen( pvol, "r" )) != NULL )
{
while(fgets( buf, sizeof(buf), stream ))
{
if(i=strstr(buf,"DeviceID=") != NULL)
{
sscanf( buf, "DeviceID=%s",deviceID);
break;
}
}
fclose( stream );
//make dir named with DeivceID
GetWindowText(hFileList,bufFileList,sizeof(bufFileList)/sizeof(TCHAR));
GetWindowText(hDstDir,bufDstDir,sizeof(bufDstDir)/sizeof(TCHAR));
strcpy(temp,bufDstDir);
strcat(temp,"\\");
CreateDirectory(strcat(temp,deviceID),NULL);
//started to copy and show log
len = strlen(bufFileList);
for(i=0;i<len;i++)
{
buflist[j][k++] = bufFileList[i];
if(bufFileList[i] == '\n')
{
k--;
buflist[j][k] =0;
buflist[j][--k] =0;
j++;
k=0;
}
}
for(j=0;buflist[j][0] != 0;j++)
{
pvol = &(arg->vol);
pvol[1] = 0;
strcat(pvol,":");
strcat(pvol,buflist[j]);
strcpy(temp,bufDstDir);
strcat(temp,"\\");
strcat(temp,deviceID);
CopyFile(pvol,strcat(temp,getFileName(buflist[j])),FALSE);
//set log
hLog = GetDlgItem(arg->hWndDlg,IDC_LOG);
GetWindowText(hLog,buf2,sizeof(buf2));
wsprintf(subStr,"#复制文件【】到【】...\r\n");
strcat(buf2,subStr);
SetWindowText(hLog,buf2);
}
}
else
{
MessageBox(NULL,NULL,"无法打开Device.ini文件",MB_ICONINFORMATION);
}
}
// 替换字符串中特征字符串为指定字符串
int ReplaceStr(char *sSrc, char *sMatchStr, char *sReplaceStr)
{
int StringLen;
char caNewString[1024];
char *FindPos = strstr(sSrc, sMatchStr);
if( (!FindPos) || (!sMatchStr) )
return -1;
while( FindPos )
{
memset(caNewString, 0, sizeof(caNewString));
StringLen = FindPos - sSrc;
strncpy(caNewString, sSrc, StringLen);
strcat(caNewString, sReplaceStr);
strcat(caNewString, FindPos + strlen(sMatchStr));
strcpy(sSrc, caNewString);
FindPos = strstr(sSrc, sMatchStr);
}
return 0;
}
LPTSTR ReadConfigFile(LPTSTR key)
{
HANDLE hFile = CreateFile(configFileName,GENERIC_READ,FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
err=GetLastError();
CloseHandle(hFile);
if(err == 2) // file not exists
{
HANDLE hFile = CreateFile(configFileName,GENERIC_WRITE,FILE_SHARE_WRITE,NULL,CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL);
CloseHandle(hFile);
// err=GetLastError();
// sprintf(buf,"%d",err);
// MessageBox(NULL,buf,NULL,0);
}
else
{
//load config to app
GetPrivateProfileString("config","filelist","",bufFileList,sizeof(bufFileList),configFileName);
GetPrivateProfileString("config","dstdir","",bufDstDir,sizeof(bufDstDir),configFileName);
ReplaceStr(bufFileList,";","\r\n");
if(strcmp(key,"filelist") == 0)
return bufFileList;
if(strcmp(key,"dstdir") == 0)
return bufDstDir;
}
return NULL;
}
BOOL WriteConfigFile(TCHAR *bufFileList,TCHAR *bufDstDir)
{
ReplaceStr(bufFileList,"\r\n",";");
i=WritePrivateProfileString("config","filelist",bufFileList,configFileName);
WritePrivateProfileString("config","dstdir",bufDstDir,configFileName);
return TRUE;
}
/*------------------------------------------------------------------
FirstDriveFromMask (unitmask)
Description
Finds the first valid drive letter from a mask of drive letters.
The mask must be in the format bit 0 = A, bit 1 = B, bit 2 = C,
and so on. A valid drive letter is defined when the
corresponding bit is set to 1.
Returns the first drive letter that was found.
--------------------------------------------------------------------*/
char FirstDriveFromMask (ULONG unitmask)
{
char i;
for (i = 0; i < 26; ++i)
{
if (unitmask & 0x1)
break;
unitmask = unitmask >> 1;
}
return (i + 'A');
}
int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow )
{
DialogBox(hInstance, MAKEINTRESOURCE(IDD_MAIN),
hWnd, DlgProc);
return 0;
}
//---------------------------------------------------------------------------
LRESULT CALLBACK DlgProc(HWND hWndDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
hFileList = GetDlgItem(hWndDlg,IDC_FILE_LIST);
hDstDir = GetDlgItem(hWndDlg,IDC_DST_DIR);
hLog = GetDlgItem(hWndDlg,IDC_LOG);
hBtnSave = GetDlgItem(hWndDlg,IDC_BTN_SAVE);
hBtnBrowse = GetDlgItem(hWndDlg,IDC_BTN_BROWSE);
switch(Msg)
{
case WM_INITDIALOG:
//icon setting
hIcon = (HICON)LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_ICON4));
SendMessage(hWndDlg, WM_SETICON, ICON_BIG , (LPARAM)hIcon);
hIconSm = (HICON)LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON4));
SendMessage(hWndDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);
//read config file , if not exist, create a new one
SetWindowText(hFileList,ReadConfigFile("filelist"));
SetWindowText(hDstDir,ReadConfigFile("dstdir"));
SetWindowText(hLog,"#等待设备...\r\n");
return TRUE;
case WM_DEVICECHANGE:
dhr = (DEV_BROADCAST_HDR *)lParam;
switch(wParam)
{
case DBT_CONFIGCHANGECANCELED:
return 0;
case DBT_DEVICEARRIVAL:
if(dhr->dbch_devicetype == DBT_DEVTYP_VOLUME)
{
lpdbv = (PDEV_BROADCAST_VOLUME)dhr;
if(lpdbv->dbcv_flags == 0)
{
//sprintf(buf,"%c",FirstDriveFromMask(lpdbv->dbcv_unitmask));
pArgs arg;
arg = malloc(sizeof(struct ArgsTag));
GetWindowText(hLog,buf2,sizeof(buf2));
arg->vol= FirstDriveFromMask(lpdbv->dbcv_unitmask);
arg->hWndDlg = hWndDlg;
wsprintf(subStr,"#检测盘符...【%c】盘\r\n",arg->vol);
strcat(buf2,subStr);
SetWindowText(hLog,buf2);
Sleep(1000);
//UsbCopyFile(ReadConfigFile("filelist"),ReadConfigFile("dstdir"), vol);
_beginthread ((LPVOID)CopyThread, 0, (LPVOID)arg) ;
}
}
return 0;
}
break;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_FILE_LIST:
if(HIWORD(wParam) == EN_CHANGE)
{
EnableWindow(hBtnSave,TRUE);
}
return TRUE;
case IDC_DST_DIR:
if(HIWORD(wParam) == EN_CHANGE)
{
EnableWindow(hBtnSave,TRUE);
}
return TRUE;
case IDCANCEL:
EndDialog(hWndDlg, 0);
return TRUE;
case IDC_BTN_SAVE:
//content of file list
/*
i = HIWORD(wParam);
i = LOWORD(wParam);
i = lParam;
*/
GetWindowText(hFileList,bufFileList,sizeof(bufFileList)/sizeof(TCHAR));
GetWindowText(hDstDir,bufDstDir,sizeof(bufDstDir)/sizeof(TCHAR));
//write config
WriteConfigFile(bufFileList,bufDstDir);
EnableWindow(hBtnSave,FALSE);
return TRUE;
case IDC_BTN_BROWSE:
//ZeroMemory(szPath, sizeof(szPath));
ZeroMemory(&bi,sizeof(BROWSEINFO));
bi.hwndOwner = NULL; //HWND句柄
bi.pidlRoot = NULL; //默认值为NULL
bi.lpszTitle = ("文件浏览对话框"); //对话框标题
bi.pszDisplayName = szPath; //选择文件夹路径
bi.ulFlags = BIF_RETURNONLYFSDIRS; //标记
bi.lpfn = NULL; //默认值为NULL
bi.lParam = 0; //回调消息
lpItemIdList = SHBrowseForFolder(&bi); //显示文件浏览对话框
if(SHGetPathFromIDList(lpItemIdList,szPath))
SetWindowText(hDstDir,szPath);
return TRUE;
}
break;
}//end of Msg
return FALSE;
}
//---------------------------------------------------------------------------
```
```
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by UsbAutoCopy.rc
//
#define IDD_MAIN 101
#define IDI_ICON1 102
#define IDI_ICON2 103
#define IDI_ICON3 104
#define IDI_ICON4 110
#define IDC_EDIT1 1000
#define IDC_FILE_LIST 1000
#define IDC_EDIT2 1001
#define IDC_LOG 1001
#define IDC_EDIT3 1002
#define IDC_DST_DIR 1002
#define IDC_BUTTON1 1003
#define IDC_BTN_BROWSE 1003
#define IDC_BUTTON2 1004
#define IDC_BTN_SAVE 1004
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 111
#define _APS_NEXT_COMMAND_VALUE 40002
#define _APS_NEXT_CONTROL_VALUE 1005
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
```
: the resource script
```
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Chinese (P.R.C.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
#ifdef _WIN32
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
#pragma code_page(936)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_MAIN DIALOG DISCARDABLE 200, 150, 449, 271
STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP |
WS_CAPTION | WS_SYSMENU
CAPTION "USB AutoCopy"
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "设置",IDC_STATIC,8,8,181,255
GROUPBOX "日志",IDC_STATIC,201,8,240,255
EDITTEXT IDC_FILE_LIST,18,37,160,134,ES_MULTILINE |
ES_AUTOHSCROLL | ES_WANTRETURN | NOT WS_BORDER
EDITTEXT IDC_LOG,213,25,220,227,ES_MULTILINE | ES_AUTOVSCROLL |
ES_AUTOHSCROLL | ES_WANTRETURN | NOT WS_BORDER |
WS_VSCROLL | WS_HSCROLL
EDITTEXT IDC_DST_DIR,18,198,110,14,ES_AUTOHSCROLL | ES_READONLY
PUSHBUTTON "浏览",IDC_BTN_BROWSE,128,198,50,14
PUSHBUTTON "保存设置",IDC_BTN_SAVE,21,234,147,20
CONTROL "文件列表",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP |
WS_GROUP,18,25,160,8
LTEXT "复制到目录",IDC_STATIC,18,185,110,8
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_MAIN, DIALOG
BEGIN
LEFTMARGIN, 8
RIGHTMARGIN, 441
TOPMARGIN, 8
BOTTOMMARGIN, 263
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON4 ICON DISCARDABLE "Device-USB.ico"
#endif // Chinese (P.R.C.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
```
|
get handle in thread function
|
CC BY-SA 3.0
| null |
2011-06-30T08:34:17.697
|
2011-07-01T01:41:24.487
|
2011-07-01T01:41:24.487
| 298,553 | 298,553 |
[
"c",
"windows",
"winapi"
] |
6,532,275 | 1 | null | null | 7 | 1,187 |
As the below snapshot when debugging, I see members listed between brackets. What are they?

|
What is the member in brackets [...] when viewing in `Watch`?
|
CC BY-SA 3.0
| 0 |
2011-06-30T08:50:02.257
|
2013-08-08T13:56:56.407
| null | null | 248,616 |
[
"visual-studio",
"debugging",
"watch"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.