I am having database in .dbf (Foxpro) formate.
1) How to retrieve data from Foxpro using Java.
2) If the data can be migrated to MySql, How to do the conversion. Pls help me.
Hi,
I am wondering if there is a tool or technique which, given a BNF grammar, adjusts it randomly(but intelligently) and generates a stream of output for use in detecting cases that slip past the BNF (but shouldn't).
Thanks
I am experimenting with a WYSIWYG editor that allows a user to draw shapes on a page and the Qt graphics scene support seems perfect for this. However, instead of working in pixels I want all my QGraphicsItem objects to work in tenths of a millimetre but I don't know how to achieve this.
For example:
// Create a scene that is the size if an A4 page (2100 = 21cm, 2970 = 29.7cm)
QGraphicsScene* scene = new QGraphicsScene(0, 0, 2100, 2970);
// Add a rectangle located 1cm across, 1cm down, 5cm wide and 2cm high
QGraphicsItem* item = scene->addRect(100, 100, 500, 200);
...
QGraphicsView* view = new QGraphicsView(scene);
setCentralWidget(view);
Now, when I display the scene above I want the shapes to appear at correct size for the screen DPI. Is this simply a case of using QGraphicsView::scale or do I have to do something more complicated?
Note that if I was using a custom QWidget instead then I would use QPainter::setWindow and QPainter::setViewport to create a custom mapping mode but I can't see how to do this using the graphics scene support.
Can somebody please provide some sample code to strip diacritical marks (i.e., replace characters having accents, umlauts, etc., with their unaccented, unumlauted, etc., character equivalents, e.g., every accented é would become a plain ASCII e) from a UnicodeString using the ICU library in C++? E.g.:
UnicodeString strip_diacritics( UnicodeString const &s ) {
UnicodeString result;
// ...
return result;
}
Assume that s has already been normalized. Thanks.
Basically, this is what I currently use in an included file:
$sites[0]['url'] = "http://example0.com";
$sites[1]['url'] = "http://example1.com";
$sites[2]['url'] = "http://example2.com";
$sites[3]['url'] = "http://example3.com";
$sites[4]['url'] = "http://example4.com";
$sites[5]['url'] = "http://example5.com";
And so I output it like so:
foreach($sites as $s)
But I want to make it easier to manage via a MySQL database. So my question is, how can I make it automatically add additional "$sites[x]['url'] = "http://examplex.com";" and output it appropriately from my MySQL table?
Some javascript libraries, such as JQuery and Dojo, provide AOP APIs that can introduce before, after, or around advice to a function. Just wondering whether there is any javascript AOP libraries can introduce such advices to an individual statement?
How do you work with someone when they haven't been able to see that there is a range of other languages out there beyond "The One True Path"?
I mean someone who hasn't realised that the modern software professional has a range of tools in his toolbox. The person whose knee jerk reaction is, for example, "We must do this is C++!" "Everything must be done in C++!"
What's the best approach to open people up to the fact that "not everything is a nail"? How may I introduce them to having a well-equipped toolbox, selecting the best tool for the job at hand?
I'm trying to setup my first Rails3 project and, early on, I'm running into problems with either uuidtools, my UUIDHelper or perhaps callbacks. I'm obviously trying to use UUIDs and (I think) I've set things up as described in Ariejan de Vroom's article. I've tried using the UUID as a primary key and also as simply a supplemental field, but it seems like the UUIDHelper is never being called.
I've read many mentions of callbacks and/or helpers changing in Rails3, but I can't find any specifics that would tell me how to adjust. Here's my setup as it stands at this moment (there have been a few iterations):
# migration
class CreateImages < ActiveRecord::Migration
def self.up
create_table :images do |t|
t.string :uuid, :limit => 36
t.string :title
t.text :description
t.timestamps
end
end
...
end
# lib/uuid_helper.rb
require 'rubygems'
require 'uuidtools'
module UUIDHelper
def before_create()
self.uuid = UUID.timestamp_create.to_s
end
end
# models/image.rb
class Image < ActiveRecord::Base
include UUIDHelper
...
end
Any insight would be much appreciated.
Thanks.
Is it possible to call Server.Execute with a .NET .aspx page from classic ASP? My tests so far have indicated this is not working but I'm still somewhat convinced there is a way.
I'm trying to set up the NERDComment plugin in vim, but I'm having some trouble with the keys. I'd like to set the basic toggle functionality (comment a line if it's uncommented, uncomment if it's commented) to be c. The problem is that I've remapped the Leader to be ,, which is the same key that NERD wants for all of it's hotkeys. Anyone have any idea as to how to set this up?
I'm making a TCP socket server(ruby). A thread is created for each connected client. At some point I try to send data to all connected clients. The thread aborts on exception while trying.(ruby 1.8.7)
require 'socket'
# I test it home right now
server = TCPServer.new('localhost', 12345);
while(session = server.accept)
#Here is the thread being created
Thread.new(session) do |s|
while(msg = s.gets)
#Here is the part that causes the error
Thread.list.each { |aThread|
if aThread != Thread.current
#So what I want it to do is to echo the message from one client to all others
#But for some reason it doesn't, and aborts on the following string
aThread.print "#{msg}\0"
end
}
end
end
Thread.abort_on_exception = true
end
What am I doing wrong?
I have Eclipse set up fairly nicely to run the G++ compiler through Cygwin. Even the character encoding is set up correctly!
There still seems to be something wrong with my configuration: I can't debug. The pause button in the debug view is simply disabled, and no threads appear in my application tree. It seems that gdb is simply not communicating with Eclipse.
Presently, I have the debug settings as follows:
Debugger: "Cygwin gdb Debugger"
GDB debugger: gdb
GDB command file: .gdbinit
Protocol: Default
I should mention here that I have no idea what .gdbinit does; in my project it is merely an empty file.
What is wrong with my configuration?
Debugging
When attempting to terminate the application in debug mode, Eclipse displays the following error:
Target request failed: failed to interrupt.
I can't kill the process, either; I have to kill its parent gdb.exe, which in turn kills my application.
Running
When running it normally, a bunch of kill.exes are called, doing nothing, while Eclipse displays the following error:
Terminate failed.
I can kill FaceDetector.exe from the task manager.
Process Explorer
This is what it looks like in Process Explorer (debugging left, running right):
I want to have a structure token that has start/end pairs for position, sentence, and paragraph information. I also want the members to be accessible in two different ways: as a start/end pair and individually. Given:
struct token {
struct start_end {
int start;
int end;
};
start_end pos;
start_end sent;
start_end para;
typedef start_end token::*start_end_ptr;
};
I can write a function, say distance(), that computes the distance between any of the three start/end pairs like:
int distance( token const &i, token const &j, token::start_end_ptr mbr ) {
return (j.*mbr).start - (i.*mbr).end;
}
and call it like:
token i, j;
int d = distance( i, j, &token::pos );
that will return the distance of the pos pair. But I can also pass &token::sent or &token::para and it does what I want. Hence, the function is flexible.
However, now I also want to write a function, say max(), that computes the maximum value of all the pos.start or all the pos.end or all the sent.start, etc.
If I add:
typedef int token::start_end::*int_ptr;
I can write the function like:
int max( list<token> const &l, token::int_ptr p ) {
int m = numeric_limits<int>::min();
for ( list<token>::const_iterator i = l.begin(); i != l.end(); ++i ) {
int n = (*i).pos.*p; // NOT WHAT I WANT: It hard-codes 'pos'
if ( n > m )
m = n;
}
return m;
}
and call it like:
list<token> l;
l.push_back( i );
l.push_back( j );
int m = max( l, &token::start_end::start );
However, as indicated in the comment above, I do not want to hard-code pos. I want the flexibility of accessible the start or end of any of pos, sent, or para that will be passed as a parameter to max().
I've tried several things to get this to work (tried using unions, anonymous unions, etc.) but I can't come up with a data structure that allows the flexibility both ways while having each value stored only once.
Any ideas how to organize the token struct so I can have what I want?
Attempt at clarification
Given struct of pairs of integers, I want to be able to "slice" the data in two distinct ways:
By passing a pointer-to-member of a particular start/end pair so that the called function operates on any pair without knowing which pair. The caller decides which pair.
By passing a pointer-to-member of a particular int (i.e., only one int of any pair) so that the called function operates on any int without knowing either which int or which pair said int is from. The caller decides which int of which pair.
Another example for the latter would be to sum, say, all para.end or all sent.start.
Also, and importantly: for #2 above, I'd ideally like to pass only a single pointer-to-member to reduce the burden on the caller. Hence, me trying to figure something out using unions.
I have the UIPicker setup with multiple components and a button below it. Depending on what the user has chosen with the UIPicker determines which new view will be loaded but I am having trouble determining how to extrapolate the information from the picker itself. Right now I have this method being called when the button is pressed:
- (IBAction) buttonPressed {
if (component:1 == 1 && component:2 == 1) {
//Load the view number 1.
} else if (component:1 == 2 && component:2 == 1) {
//Load the view number 2.
} else {
//Load the view number 3.
}
}
I obviously know that my code is wrong but I hope it gets the point across. I have multiple components and I need to figure out how to use the information that the user is scrolling to on the picker to determine which view to move to. (I know how to load the views, I just commented those in the code to illuminate the problem areas better.)
I've got an app that does Text-To-Speech; but I wanted to show an animated face/character to go with it. I found a tutorial on Microsoft Agent and I implemented it in my vb.net app.
The problem is with the transparency color.
Unless I run application in compatibility mode/256 colors, the characters will appear with a purplish-pink background image instead of a transparent back-color. But running the app in 256 colors the rest of the app looks awfully out of place.
First - is there something that works similar to MS Agent I can use that would be more appropriate?
Second - if I'm still MS Agent - can I get the transparent color to work correctly without limiting myself to 256 colors?
Hello.
I would like to know if there's a combo like jCryption ([jCryption]) - PHP but for jQuery - ASPX.
I mean, I have been searching for a combo to send data both ways (Client-server, server-client) with jQuery to ASPX. The best I found was jCryption that sends data from JavaScrpit to PHP. I need a combo to send data from JavaScrpit to ASPX.
Any ideas??
PD: Please don't tell me to use HTTPS, it's not enough to ensure the data communication on a client - server application.
I have a table in Postgres that looks like this:
CREATE TABLE "Population"
(
"Id" bigint NOT NULL DEFAULT nextval('"population_Id_seq"'::regclass),
"Name" character varying(255) NOT NULL,
"Description" character varying(1024),
"IsVisible" boolean NOT NULL
CONSTRAINT "pk_Population" PRIMARY KEY ("Id")
)
WITH (
OIDS=FALSE
);
And a select function that looks like this:
CREATE OR REPLACE FUNCTION "Population_SelectAll"()
RETURNS SETOF "Population" AS
$BODY$select
"Id",
"Name",
"Description",
"IsVisible"
from "Population";
$BODY$
LANGUAGE 'sql' STABLE
COST 100
Calling the select function returns all the rows in the table as expected.
I have a need to add a couple of columns to the table (both of which are foreign keys to other tables in the database). This gives me a new table def as follows:
CREATE TABLE "Population"
(
"Id" bigint NOT NULL DEFAULT nextval('"population_Id_seq"'::regclass),
"Name" character varying(255) NOT NULL,
"Description" character varying(1024),
"IsVisible" boolean NOT NULL,
"DefaultSpeciesId" bigint NOT NULL,
"DefaultEcotypeId" bigint NOT NULL,
CONSTRAINT "pk_Population" PRIMARY KEY ("Id"),
CONSTRAINT "fk_Population_DefaultEcotypeId" FOREIGN KEY ("DefaultEcotypeId")
REFERENCES "Ecotype" ("Id") MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "fk_Population_DefaultSpeciesId" FOREIGN KEY ("DefaultSpeciesId")
REFERENCES "Species" ("Id") MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (
OIDS=FALSE
);
and function:
CREATE OR REPLACE FUNCTION "Population_SelectAll"()
RETURNS SETOF "Population" AS
$BODY$select
"Id",
"Name",
"Description",
"IsVisible",
"DefaultSpeciesId",
"DefaultEcotypeId"
from "Population";
$BODY$
LANGUAGE 'sql' STABLE
COST 100
ROWS 1000;
Calling the function after these changes results in the following error message:
ERROR: could not find attribute 11 in subquery targetlist
SQL state: XX000
What is causing this error and how do I fix it? I have tried to drop and recreate the columns and function - but the same error occurs.
Platform is PostgreSQL 8.4 running on Windows Server. Thanks.
I was reading a question about MD5, and it made me remember something that boggles me. Very simple question, and I'm sorry if it's not a good one. I just can't understand how you convert something to one thing using some algorithm, and there being no way to convert it back using the algorithm in reverse.
So how is this possible?
Also, since multiple strings can create the same MD5 hash, due to it being less data than the input string, how would any other hashing system be any better?
Well basically I've got a vb.net script connecting to IRC, and I'm working on making it a basic chat system, but I've run into a problem.
Say I receive this:
:[email protected] PRIVMSG #channel :message
I want to grab specific information to output to the user.
I want to grab nickname and message
How can I go about doing this?
I thought about using regex, but I can't figure out how to make regex grab message since there's nothing after it.
I am re-using Apple's AdvancedTableViewCells example to create a custom, fast-scrolling tableview. Specifically, I am using their CompositeSubviewBasedApplicationCell method which draws the content on the tableviewcell with drawRect
Everything works, but how do you hide a label or set the tag for a label or image using their method? Doing it this way is pretty new to me (without IB), so I apologize ahead of time if it's something easy.
The code that sets the cell content is:
- (void)drawRect:(CGRect)rect
{
[_cell.animalIcon drawAtPoint:CGPointMake(5.0, 5.0)];
[_cell.animalName drawAtPoint:CGPointMake(93.0, 25.0)];
_highlighted ? [[UIColor whiteColor] set] : [[UIColor colorWithWhite:0.23 alpha:1.0] set];
[_cell.animalDescription drawAtPoint:CGPointMake(100.0, 54.0) withFont:[UIFont boldSystemFontOfSize:13.0]];
[_cell.animalNameString drawAtPoint:CGPointMake(93.0, 5.0) withFont:[UIFont boldSystemFontOfSize:13.0]];
}
I have a Hibernate entity that looks like this (accessors ommitted for brevity):
@Entity
@Table(name="FeatureList_Version")
@SecondaryTable(name="FeatureList",
pkJoinColumns=@PrimaryKeyJoinColumn(name="FeatureList_Key"))
public class FeatureList implements Serializable {
@Id
@Column(name="FeatureList_Version_Key")
private String key;
@Column(name="Name",table="FeatureList")
private String name;
@Column(name="VERSION")
private Integer version;
}
I want to craft an HQL query that retrieves the most up to date version of a FeatureList. The following query sort of works:
Select f.name, max(f.version) from FeatureList f group by f.name
The trouble is that won't populate the key field, which I need to contain the key of the record with the highest version number for the given FeatureList. If I add f.key in the select it won't work because it's not in the group by or an aggregate and if I put it in the group by the whole thing stops working and it just gives me every version as a separate entity.
So, can anybody help?
In my masterpage, I have the following in the header.
This allows me to put special characters into my website. The problem is that when javascript tries to load (on the client) special characters, I get that weird box.
Example url...
http://89.184.149.229/Sandportal/vinnan/trol-lna/monica-sakk--vikuskiftinum
Text is below the 4 stars (mid left).
Any help is greatly appreciated.
How do you add a JAR file to an already existing Java library in Eclipse? Note that this is not a user library.
That is, if you look at the Java Build Path for a Java project and click on the Libraries tab, you will see the list of libraries used by the project. If you expand a given library, you will see a list of JAR files included in that library. I want to add an additional JAR file to one of these libraries.
I am using Version 3.4.0 of Eclipse.
I have a Java application sending HTTP requests to a C# application. The C# app uses HTTPListener to listen for requests and respond. On the Java side I'm encoding the URL using UTF-8.
When I send a \ character it gets encoded as %5C as expected but on the C# side it becomes a / character. The encoding for the request object is Windows-1252 which I think may be causing the problem. How do I set the default encoding to UTF-8?
Currently I'm doing this to convert the encoding:
foreach (string key in request.QueryString.Keys)
{
if (key != null)
{
byte[] sourceBytes =request.ContentEncoding.GetBytes(request.QueryString[key]);
string value = Encoding.UTF8.GetString(sourceBytes));
}
}
This handles the non ASCII characters I'm also sending but doesn't fix the slash problem. Examining request.QueryString[key] in the debugger shows that the / is already there.
Hello all,
I am getting some odd behavior from stock table cells, or maybe not odd, maybe I am making some assumptions.
I create the cells as follows:
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
Then I assign an image to the default imageView property. My image usually comes in from a user, so it might be larger than the default size. To take care of this I:
[cell.imageView setContentMode:UIViewContentModeScaleAspectFit];
which I expected to scale the image for me within the control, but in reality, the images are all over the map.
So, is there a proper way to constrain the image in stock cell types?
Thanks in advance!