I know this has been asked before, and I tried to implement the solution, but I just get exception errors when I call ps-executeUpdate(). Has anyone got an explicit example?
I'm trying to make a JFrame with a usable content area of exactly 500x500. If I do this...
public MyFrame() {
super("Hello, world!");
setSize(500,500);
}
... I get a window whose full size is 500x500, including the title bar, etc., where I really need a window whose size is something like 504x520 to account for the window border and titlebar. How can I achieve this?
Hey guys, I am working on an iPhone project where i need to change the width and height of a UIImageView dynamically. I have come across CGPointMake to change x & y positions alone, but what should i use for changing width & height alone??. There's something called CGSizeMake but i am not able to make it work. Can someone help...any idea abt this....???..
Thanks.
i have an asp.net mvc site and here is a dynamic tooltip using qTip
Here is my code:
$('a.showNutritionInfo').each(function() {
$(this).qtip({
content: {
text: '<img src="../../images/ajax-loader1.gif" alt="" />',
style: { width: 450 },
url: '/Tracker/NutritionInfo/' + $(this).attr('id'),
method: 'get'
}
});
});
this works perfectly EXCEPT the width attribute listed above is ignored. No matter what i put in that width attribute, i get the same size width tooltip which is about half of the width that i need. the height is perfectly fine.
any ideas? is this a bug in the product ?
Hi, i'm trying to put a translucing texture on a face which uses points 1 to 4 (don't mind the numbers) on the following screenshot
Sadly as you can see the texture repeats herself in both dimensions, I tried to switch the TEXTURE_WRAP_S from REPEAT to CLAMP_to_EDGE but it doesn't change anything. Texture loading code is here :
gl.glBindTexture(gl.GL_TEXTURE_2D, mTexture.get(4));
gl.glActiveTexture(4);
gl.glTexParameterf(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MIN_FILTER,
gl.GL_LINEAR);
gl.glTexParameterf(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MAG_FILTER,
gl.GL_LINEAR);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);
gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, gl.GL_RGBA,
shadowbmp.width, shadowbmp.height, 0,
gl.GL_RGBA, gl.GL_UNSIGNED_SHORT_4_4_4_4,
shadowbmp.buffer);
Texture coordinates are the following :
float shadow_bot_text[] = {
0.0f, 0.0f,
0.0f, 1.0f,
1.0f, 0.0f,
1.0f, 1.0f
};
Thanks
Hi
I'm trying to display a QLabel (without parent) at a fixed position using PyQt. The QLabel functions as a graphic that appears only for a moment, it's appears in the middle of the screen by default but I can't find how to move its position.
Any suggestion??
So i have started building android from scratch and after lot of effort finally landed up to a point where i have the OUT folder consisting of all the required IMG files for an emulator to run.
Like the
system.img
ramdisk.img
userdata-qemu.img
So after that i ran the emulator command so that means the OUT directory was valid and could easily be used to create any other bootable medium.
What i want to accomplish
Creating the iso file from all those img files found at the end of building process,or a way to just create an iso out of that complete OUT folder.
any help in this regard would be greatly appreciated.
I was following Hibernate: Use a Base Class to Map Common Fields and openjpa inheritance tutorial to put common columns like ID, lastModifiedDate etc in base table.
My annotated mappings are as follow :
BaseTable :
@MappedSuperclass
public abstract class BaseTable {
@Id
@GeneratedValue
@Column(name = "id")
private int id;
@Column(name = "lastmodifieddate")
private Date lastModifiedDate;
...
Person table -
@Entity
@Table(name = "Person ")
public class Person extends BaseTable implements Serializable{
...
Create statement generated :
create table Person (id integer not null auto_increment, lastmodifieddate datetime, name varchar(255), primary key (id)) ;
After I save a Person object to db,
Person p = new Person();
p.setName("Test");
p.setLastModifiedDate(new Date());
..
getSession().save(p);
I am setting the date field but, it is saving the record with generated ID and LastModifiedDate = null, and Name="Test".
Insert Statement :
insert into Person (lastmodifieddate, name) values (?, ?)
binding parameter [1] as [TIMESTAMP] - <null>
binding parameter [2] as [VARCHAR] - Test
Read by ID query :
When I do hibernate query (get By ID) as below, It reads person by given ID.
Criteria c = getSession().createCriteria(Person.class);
c.add(Restrictions.eq("id", id));
Person person= c.list().get(0);
//person has generated ID, LastModifiedDate is null
select query select person0_.id as id8_, person0_.lastmodifieddate as lastmodi8_, person0_.name as person8_ from Person person0_
- Found [1] as column [id8_]
- Found [null] as column [lastmodi8_]
- Found [Test] as column [person8_]
ReadAll query :
//read all
Query query = getSession().createQuery("from " + Person.class.getName());
List allPersons=query.list();
Corresponding SQL for read all
select query select person0_.id as id8_, person0_.lastmodifieddate as lastmodi8_, person0_.name as person8_ from Person person0_
- Found [1] as column [id8_]
- Found [null] as column [lastmodi8_]
- Found [Test] as column [person8_]
- Found [2] as column [id8_]
- Found [null] as column [lastmodi8_]
- Found [Test2] as column [person8_]
But when I print out the list in console, its being more weird. it is selecting List of Person object with
ID fields = all 0 (why all 0 ?)
LastModifiedDate = null
Name fields have valid values
I don't know whats wrong here. Could you please look at it?
FYI,
My Hibernate-core version : 4.1.2, MySQL Connector version : 5.1.9 .
In summary, There are two issues here
Why I am getting All ID Fields =0 when using read all?
Why the LastModifiedDate is not being inserted?
I have a weird relationship that needs to be maintained for legacy processes.
I'm trying to figure out how to create the relationship given the new model association.
New Relationship Setup
Machine
has_many MachineReadings
has_many Disks
has_many DiskReadings
Old Relationship Setup
Machine
has_many MachineReadings
has_many DiskReadings
has_many Disks
The problem is data will come in on the Machine model as nested attributes using the new relationship setup. I need to update the machine_reading_id in the DiskReading model so the old association can continue to be used.
I tried doing this via an after_save hook that would traverse back up to the machine and then down to the readings to get the machine_reading.id so I could populate the DiskReading model. However, the associations aren't being saved in the order I would expect. They are saving the Disks & DiskReadings before saving the MachineReadings. So when I go after the machine_reading.id it hasn't been written and thus I am unable to get access to it.
For example:
#machine_disk_reading.rb
after_save :build_old_relationship
def build_old_relationship
self.machine_reading_id = self.disk.machine.readings.find_by_date_time(self.date_time).id
end
I am afraid this is a brain fart question. But I have searched around and have not been able to find the answer.
I am creating a GridView/DetailsView page. I have a grid that displays a bunch of rows, when a row is selected it uses a DetailsView to allow for Insert/Update.
My question is what is the best way to link these? I do not want to reach out to the web service again, all the data i need is in the selected grid view row. I basically have 2 separate data sources that share the same "DataObjectTypeName", the first data source retrieves the data, and the other to do the CRUD.
What is the best way to transfer the Selected Grid View row to the Details View? Am I going to have to manualy handle the Insert/Update events and call the data source myself?
<asp:GridView ID="gvDetails" runat="server" DataKeyNames="ID, Code"
DataSourceID="odsSearchData" >
<Columns>
<asp:BoundField DataField="RowA" HeaderText="A" SortExpression="RowA" />
<asp:BoundField DataField="RowB" HeaderText="B" SortExpression="RowB" />
<asp:BoundField DataField="RowC" HeaderText="C" SortExpression="RowC" />
....Code...
<asp:DetailsView ID="dvDetails" runat="server" DataKeyNames="ID, Code"
DataSourceID="odsCRUD" GridLines="None" DefaultMode="Edit" AutoGenerateRows="false"
Visible="false" Width="100%">
<Fields>
<asp:BoundField DataField="RowA" HeaderText="A" SortExpression="RowA" />
<asp:BoundField DataField="RowB" HeaderText="B" SortExpression="RowB" />
<asp:BoundField DataField="RowC" HeaderText="C" SortExpression="RowC" />
...
I'm using the awesome_nested_set plugin in my Rails project. I have two models that look like this (simplified):
class Customer < ActiveRecord::Base
has_many :categories
end
class Category < ActiveRecord::Base
belongs_to :customer
# Columns in the categories table: lft, rgt and parent_id
acts_as_nested_set :scope => :customer_id
validates_presence_of :name
# Further validations...
end
The tree in the database is constructed as expected. All the values of parent_id, lft and rgt are correct. The tree has multiple root nodes (which is of course allowed in awesome_nested_set).
Now, I want to render all categories of a given customer in a correctly sorted tree like structure: for example nested <ul> tags. This wouldn't be too difficult but I need it to be efficient (the less sql queries the better).
Update: Figured out that it is possible to calculate the number of children for any given Node in the tree without further SQL queries: number_of_children = (node.rgt - node.lft - 1)/2. This doesn't solve the problem but it may prove to be helpful.
Hello,
I am using the curl found in /usr/bin/curl (Not the PHP Curl )
how do I pass authorization header using curl ?
It will be great if someone can reply.
Regards,
Mithun
This morning we pull from our repo, and git put us on (no branch).
I don't understand this, why did this happen? And how get out of it without losing our changes?
I've something like this
Object[] myObjects = ...(initialized in some way)...
int[] elemToRemove = new int[]{3,4,6,8,...}
What's the most efficient way of removing the elements of index position 3,4,6,8... from myObjects ?
I'd like to implement an efficient Utility method with a signature like
public Object[] removeElements(Object[] object, int[] elementsToRemove) {...}
The Object[] that is returned should be a new Object of size myObjects.length - elemToRemove.length
Hi,
i want to display a big string in Qlablel for this simply i have created a label in Qt GUI editor,
then i put the string, with the Wordwrap property ON.
here text is not coming to the next line itself, instead its crossing the view region.
but if i give "\n" it works well.
how to put up big string in label, to display in visible region.
I am using the StarIO SDK to print text to a receipt printer and I am trying to get a certain line of text larger than the rest. I have some help from their support but I can't really get it to go.
-(void)print{
NSMutableString *final=[NSMutableString stringWithFormat:@"-----"];
[final appendFormat:@"\n\nLevel:%@ Section:%@ Row:%@ Seat:%@", [response_dict objectForKey:@"level"], [response_dict objectForKey:@"section"],[response_dict objectForKey:@"row"],[response_dict objectForKey:@"seat"]];
There is a bunch of other stuff that is printing, but that is the line that I would like to be a different size than the rest. The StarIO support said that I should try and pass that to this...
-(IBAction)PrintText
{
NSString *portName = [IOS_SDKViewController getPortName];
NSString *portSettings = [IOS_SDKViewController getPortSettings];
[PrinterFunctions PrintTextWithPortname:portName portSettings:portSettings heightExpansion:heightExpansion widthExpansion:widthExpansion textData:textData textDataSize:[textNSData length]];
free(textData);
}
Would love some help if possible. :) Thanks so much.
This is the main bit I think I would need from the StarIO Text formatting doc...
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
array_hieghtExpansion = [[NSMutableArray alloc] init];
[array_hieghtExpansion addObject:@"1"];
[array_hieghtExpansion addObject:@"2"];
[array_hieghtExpansion addObject:@"3"];
[array_hieghtExpansion addObject:@"4"];
[array_hieghtExpansion addObject:@"5"];
[array_hieghtExpansion addObject:@"6"];
array_widthExpansion = [[NSMutableArray alloc] init];
[array_widthExpansion addObject:@"1"];
[array_widthExpansion addObject:@"2"];
[array_widthExpansion addObject:@"3"];
[array_widthExpansion addObject:@"4"];
[array_widthExpansion addObject:@"5"];
[array_widthExpansion addObject:@"6"];
array_alignment = [[NSMutableArray alloc] init];
[array_alignment addObject:@"Left"];
[array_alignment addObject:@"Center"];
[array_alignment addObject:@"Right"];
}
return self;
}
and
int heightExpansion = [pickerpopup_heightExpansion getSelectedIndex];
int widthExpansion = [pickerpopup_widthExpansion getSelectedIndex];
I feel like the answer to this question is really simple, but I really am having trouble finding it. So here goes:
Suppose you have the following classes:
class Base;
class Child : public Base;
class Displayer
{
public:
Displayer(Base* element);
Displayer(Child* element);
}
Additionally, I have a Base* object which might point to either an instance of the class Base or an instance of the class Child.
Now I want to create a Displayer based on the element pointed to by object, however, I want to pick the right version of the constructor. As I currently have it, this would accomplish just that (I am being a bit fuzzy with my C++ here, but I think this the clearest way)
object->createDisplayer();
virtual void Base::createDisplayer()
{
new Displayer(this);
}
virtual void Child::createDisplayer()
{
new Displayer(this);
}
This works, however, there is a problem with this:
Base and Child are part of the application system, while Displayer is part of the GUI system. I want to build the GUI system independently of the Application system, so that it is easy to replace the GUI. This means that Base and Child should not know about Displayer. However, I do not know how I can achieve this without letting the Application classes know about the GUI.
Am I missing something very obvious or am I trying something that is not possible?
When launching a process with CreateProcessW(), is it possible to have the process created with a different MBCP locale/codepage then the one that is configured as the system-wide default code page?
In the target process, this should have the same effect as calling _setmbcp().
The target process is not a unicode-enabled and uses a plain main(int argc, char **argv) entry point. I would like to be able to select the code page to which unicode arguments passed to CreateProcessW() are converted to be different from the system's default codepage for non-unicode programs.
its my first time using a ProgressBar in c#.
The idea is to use the ProgressBar as an health bar in a simple game.
The thing is I think the bar's maximum value is 100% but i would like to give it a higher value like let's say 1000% or, not sure if it's possible, give the bar an integer value instead of a percentage.
progressBar1.Increment(100);
This is where I initialize the health to 100points. Even if I use this syntax:
progressBar1.Increment(1000);
And I subtract :
progressBar1.Increment(-25);
The player is loosing 1/4 of is life as if he only had 100 Health Points.
Any idea how I could change the maximum Bar value?
Thanks in advance.
This might be an odd question, but I'm looking for a word to use in a function name. I'm normally good at coming up with succinct, meaningful function names, but this one has me stumped so I thought I'd appeal for help.
The function will take some desired state as an argument and compare it to the current state. If no change is needed, the function will exit normally without doing anything. Otherwise, the function will take some action to achieve the desired state.
For example, if wanted to make sure the front door was closed, i might say:
my_house.<something>_front_door('closed')
What word or term should use in place of the something? I'd like it to be short, readable, and minimize the astonishment factor.
A couple clarifying points...
I would want someone calling the function to intuitively know they didn't need to wrap the function an 'if' that checks the current state. For example, this would be bad:
if my_house.front_door_is_open():
my_house.<something>_front_door('closed')
Also, they should know that the function won't throw an exception if the desired state matches the current state. So this should never happen:
try:
my_house.<something>_front_door('closed')
except DoorWasAlreadyClosedException:
pass
Here are some options I've considered:
my_house.set_front_door('closed')
my_house.setne_front_door('closed') # ne=not equal, from the setne x86 instruction
my_house.ensure_front_door('closed')
my_house.configure_front_door('closed')
my_house.update_front_door('closed')
my_house.make_front_door('closed')
my_house.remediate_front_door('closed')
And I'm open to other forms, but most I've thought of don't improve readability. Such as...
my_house.ensure_front_door_is('closed')
my_house.conditionally_update_front_door('closed')
my_house.change_front_door_if_needed('closed')
Thanks for any input!
I have the following html code:
<i class="small ele class1"></i>
<i class="medium ele class1"></i>
<i class="large ele class1"></i>
<div class="clear"></div>
<i class="small ele class2"></i>
<i class="medium ele class2"></i>
<i class="large ele class2"></i>
<div class="clear"></div>
<i class="small ele class3"></i>
<i class="medium ele class3"></i>
<i class="large ele class3"></i>
<div class="clear"></div>
<i class="small ele class4"></i>
<i class="medium ele class4"></i>
<i class="large ele class4"></i>?
And my javascript looks like so:
var resize = function(face, s) {
var bb = face.getBBox();
console.log(bb);
var w = bb.width;
var h = bb.height;
var max = w;
if (h > max) {
max = h;
}
var scale = s / max;
var ox = -bb.x+((max-w)/2);
var oy = -bb.y+((max-h)/2);
console.log(s+' '+h+' '+bb.y);
face.attr({
"transform": "s" + scale + "," + scale + ",0,0" + "t" + ox + "," + oy
});
}
$('.ele').each(function() {
var s = $(this).innerWidth();
var paper = Raphael($(this)[0], s, s);
var face = $(this).hasClass("class1") ? class1Generator(paper) : class4Generator(paper);
/*switch (true) {
case $(this).hasClass('class1'):
class1Generator(paper);
break;
case $(this).hasClass('class2'):
class2Generator(paper)
break;
case $(this).hasClass('class3'):
class3Generator(paper)
break;
case $(this).hasClass('class4'):
class4Generator(paper)
break;
}*/
resize(face, s);
});
my question is, how could I make this line of code more scalable? I tried using a switch but
The script below is calling two functions if one of the elements has a class, but what If i have 10 classes?
I don't think is the best solution I created a jsFiddle http://jsfiddle.net/7uUgz/6/
//var face = $(this).hasClass("awesome") ? awesomeGenerator(paper) : awfulGenerator(paper);
I'm moving my application from 3.x to 4.x as I prepare for the app store and found that I need to have 2 copies of all my custom pngs - my question is how can I determine what img to show and when. Example - how do I know to show the Find.png vs the [email protected]
Is it "safe" or "correct" to look for 4.x specific apis or does the iphone have a way to determine what platform you are on at runtime?
Thank you in advance
Hi
I try to create an hotspot by Extends of canvas and I try to add it on a panel witch painted by images , so I must to draw an icon (image) instead of clear rectangle of the screen,
to do that I override the paint method to draw the icon I want to use, so far there is no problem, the hotspot work true and the icon painted in true size I want(32,24 pixel)
I try to add this hotspot after painting image on the my panel in mypanel.paint(g) that override too.
The problem , I use an car icon that have no background !!(I hope you can understand me) just car icon must be show on the panel that painted with my images;
But an unwanted rectangle created around the icon and made bad view,
How I can paint may icon on panel without that background?
Please help me.
I'm writing an application that models train routes, which are stored in the database table [TrainStop] as follows:
RouteId
StationCode
StopIndex
IsEnabled
So a given route consists of several rows with the StopIndex indicating the order. The problem I am trying to solve is to say which stations a user can get to from a given starting station. This would be relatively straightforward BUT it is also possible to disable stops which means that a user cannot get to any destinations after that stop. It is also possible that multiple routes can share stations e.g.:
Route 1: A, B, C, D, E
Route2: P, Q, B, C, D, R
So if a user is at B they can go to C, D, E and R but if station D is disabled they can get to C only.
Solving this problem is fairly straightforward within C# but I am wondering whether it can be solved elegantly and efficiently within SQL? I'm struggling to find a way, for each route, to rule out stations past a row that is not enabled.