I need a function that will convert € or chr(0x20AC) or chr(8364) to € without having a static map.
I tried using htmlentities(), but it only seems to work for the symbol itself and it converts to €
Say you have something like this:
glBindTexture(GL_TEXTURE_2D, my2dTex);
glBindTexture(GL_TEXTURE_1D, my1dTex);
glBegin...
What is the correct OpenGL behavior? To draw the 1d texture, the 2d or both? For each active texture are there actually multiple textures that can be bound to it at the same time (i.e. a 1d, 2d, 3d cube map, etc.)?
This one has me stumped, I need to re-write all requests to the javascript folder (js) to a special library handler system.
e.g.
rewrite http://localhost/admin/js/bar.js --> http://localhost/_lib/=admin/js/bar.js
Any ideas? I have tried the following which creates an error
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteRule ^(.*)$ /%1/_lib/$1 [NC]
(36)File name to long: cannot map GET /admin/js/bar.js to file
I'm pretty sure you can, but in addition to answering the question in the title, could you also explain the pros, cons, caveats, if any, to doing so? I know that you can't return a List, Set, Collection, Map, or any interface, from a WebMethod (which is stupid, IMO, but I don't know what the design reasons were should I should probably withhold judgment).
Thanks for any advice.
--
LES
Google Maps newbie (GIS newbie), I'm looking at a solution to map an overlay (number of polygons) on-top of Google maps and wondered if using a KML file was a viable solution?
Basically, I have a number of address (address data) that I will pass to our internal GIS system, the GIS system hands me back a KML file (one file with a number of different locations) and then I draw the polygon using the KML Layering options:
https://developers.google.com/maps/documentation/javascript/layers
Sound like a viable solution?
Cheers
Is there a way to use an iframe or some other method of showing a named div from another website?
I want to pull in some data from a government website into a google map and when they click the point I want the information from one of the divs on that page to display.
I want to create a TreeMap in Java with a custom sort order. The sorted keys which are string need to be sorted according to the second character. The values are also string.
Sample map:
Za,FOO
Ab,Bar
I'm base64 encoding a JPG in AS3 and passing it to PHP where it would be decoded. It appears that AS3's encodeToBase64String() function and and PHP's base64_decode() function do not use the same algorithm.
Is there a library or API for either language that would allow it to interface with the other? Alternatively, does anyone even know what PHP's default base64 map is? My Google searching is not yielding results.
Gday, I am trying to create a tiled map for my game, i have had this previously working using other xml methods but i had memory leaks and all sorts of errors. However i had a map load time of about 2.5 - 3 seconds.
So i rewrote all of the code using NSMutableStrings and NSStrings. After my best attempt at optomizing it i had a map load time of 10 - 11 seconds, which is far too slow.
So i have now rewritten the code using char* arrays, only to now have a load time of 18 seconds -_-.
Here is the latest code, i don't know much c so i could have easily botched the whole thing up.
FILE* file = fopen(a, "r");
fseek(file, 0L, SEEK_END);
length = ftell(file);
fseek(file,0L, SEEK_SET);
char fileText[length +1];
char buffer[1024];// = malloc(1024);
while(fgets(buffer, 1024, file) != NULL)
{
strncat(fileText, buffer, strlen(buffer));
}
fclose(file);
[self parseMapFile:fileText];
- (void)parseMapFile:(char*)tiledXML
{
currentLayerID = 0;
currentTileSetID = 0;
tileX = 0;
tileY = 0;
int tmpGid;
NSString* tmpName;
int tmpTileWidth;
int tmpTileHeight;
int tilesetCounter = 0;
NSString* tmpLayerName;
int tmpLayerHeight;
int tmpLayerWidth;
int layerCounter = 0;
tileX = 0;
tileY = 0;
int tmpFirstGid = 0;
int x;
int index;
char* r;
int counter = 0;
while ((x = [self findSubstring:tiledXML substring:"\n"]) != 0)
{
counter ++;
char result[x + 1];
r = &result[0];
[self substringIndex:tiledXML index:x newArray:result];
tiledXML += x+2;
index = 0;
if (counter == 1)
{
continue;
}
else if (counter == 2)
{
char result1[5];
index = [self getStringBetweenStrings:r substring1:"th=\"" substring2:"\"" newArray:result1];
if (r != 0);
mapWidth = atoi(result1);
r += index +1;
index = 0;
index = [self getStringBetweenStrings:r substring1:"ht=\"" substring2:"\"" newArray:result1];
if (r != 0);
mapHeight = atoi(result1);
r += index +1;
index = 0;
index = [self getStringBetweenStrings:r substring1:"th=\"" substring2:"\"" newArray:result1];
if (r != 0);
tileWidth = atoi(result1);
r += index +1;
index = 0;
index = [self getStringBetweenStrings:r substring1:"ht=\"" substring2:"\"" newArray:result1];
if (r != 0);
tileHeight = atoi(result1);
continue;
}
char result2[50];
char result3[3];
if ((index = [self getStringBetweenStrings:r substring1:" gid=\"" substring2:"\"" newArray:result3]) != 0)
{
tmpGid = atoi(result3);
free(result2);
if(tmpGid == 0)
{
[currentLayer addTileAtX:tileX y:tileY tileSetID:-1 tileID:0 globalID:0];
}
else
{
[currentLayer addTileAtX:tileX
y:tileY
tileSetID:[currentTileSet tileSetID]
tileID:tmpGid - [currentTileSet firstGID]
globalID:tmpGid];
}
tileX ++;
if (tileX > [currentLayer layerWidth]-1)
{
tileY ++;
tileX = 0;
}
}
else if ((index = [self getStringBetweenStrings:r substring1:"tgid=\"" substring2:"\"" newArray:result2]) != 0)
{
tmpFirstGid = atoi(result2);
r += index +1;
index = 0;
index = [self getStringBetweenStrings:r substring1:"me=\"" substring2:"\"" newArray:result2];
if (r != 0);
tmpName = [NSString stringWithUTF8String:result2];
r += index +1;
index = 0;
index = [self getStringBetweenStrings:r substring1:"th=\"" substring2:"\"" newArray:result2];
if (r != 0);
tmpTileWidth = atoi(result2);
r += index +1;
index = 0;
index = [self getStringBetweenStrings:r substring1:"ht=\"" substring2:"\"" newArray:result2];
if (r != 0);
tmpTileHeight = atoi(result2);
}
else if ((index = [self getStringBetweenStrings:r substring1:"rce=\"" substring2:"\"" newArray:result2]) != 0)
{
currentTileSet = [[TileSet alloc] initWithImageNamed:[NSString stringWithUTF8String:result2] name:tmpName tileSetID:tilesetCounter firstGID:tmpFirstGid tileWidth:tmpTileWidth tileHeight:tmpTileHeight spacing:0];
[tileSets addObject:currentTileSet];
[currentTileSet release];
tilesetCounter ++;
}
else if ((index = [self getStringBetweenStrings:r substring1:"r name=\"" substring2:"\"" newArray:result2]) != 0)
{
tileX = 0;
tileY = 0;
tmpLayerName = [NSString stringWithUTF8String:result2];
r += index +1;
index = 0;
index = [self getStringBetweenStrings:r substring1:"th=\"" substring2:"\"" newArray:result2];
if (r != 0);
tmpLayerWidth = atoi(result2);
r += index +1;
index = 0;
index = [self getStringBetweenStrings:r substring1:"ht=\"" substring2:"\"" newArray:result2];
if (r != 0);
tmpLayerHeight = atoi(result2);
currentLayer = [[Layer alloc] initWithName:tmpLayerName layerID:layerCounter layerWidth:tmpLayerWidth layerHeight:tmpLayerHeight];
[layers addObject:currentLayer];
[currentLayer release];
layerCounter ++;
}
}
}
-(void)substringIndex:(char*)c index:(int)x newArray:(char*)result
{
result[0] = 0;
for (int i = 0; i < strlen(c); i++)
{
result[i] = c[i];
if (i == x)
{
result[i+1] = '\0';
break;
}
}
}
-(int)findSubstring:(char*)c substring:(char*)s
{
int sCounter = 0;
int index = 0;
int d;
for (int i = 0; i < strlen(c); i ++)
{
if (i > 500)//max line size
break;
if (c[i] == s[sCounter])
{
d = strlen(s);
sCounter ++;
if (d > sCounter)
{
}
else
{
index = i - (d);
break;
}
}
else
sCounter = 0;
}
return index;
}
-(int)getStringBetweenStrings:(char*)c substring1:(char*)s substring2:(char*)s2 newArray:(char*)result
{
int sCounter = 0;
int sCounter2 = 0;
int index = 0;
int index2 = 0;
int d;
for (int i = 0; i < strlen(c); i ++)
{
if (index != 0)
{
if (c[i] == s2[sCounter2])
{
d = strlen(s2);
sCounter2 ++;
if (d > sCounter2)
{
}
else
{
index2 = i - (d);
break;
}
}
else
sCounter2 = 0;
}
else
{
if (c[i] == s[sCounter])
{
d = strlen(s);
sCounter ++;
if (d > sCounter)
{
}
else
{
index = i;
}
}
else
sCounter = 0;
}
}
if (index != 0 && index2 != 0)
[self substringIndex:(c + index+1) index:index2-index-1 newArray:result];
return index;
}
(I know it's a lot of code to be putting in here)
I thought the by using basic char arrays i could drastically increase the performance, at least over the initial node based code that i was replacing.
Thanks for all your efforts.
Hi all,
I'm actively developing grails portlets for liferay till today .
I was wondering is there a future road map for next plugin releases and updates for portlet support, because i was not finding people developing portlet applications on grails on net.
Is there any portlet applications running under production ?? .
could any one please provide links if any ?
thanks,
srinath
I have a class A which have a list of B elements.
In my A class i would like to add:
int size;
which will be valued with the number of B elements. So when I would call myA.getSize() I will have it.
Is it possible to map a count query with a single property in the hibernate mapping?
I don't want to load the list that is why i would like to add a size property.
hi all,
i have an address for a location. when i click some button in my app. it should redirect to default google map in android and drop the pin to that particular location. how to do that? Any Idea?
I have an arrow image that I would like to put on a v3 Google Map and have it point to a specific direction (using bearing from a particular Lat/Long point). Is this possible?
Thanks.
Hi, I'm using the will paginate gem from http://github.com/mislav/will_paginate
Routes:
map.resources :post do |post|
post.resources :comments
end
Post Controller:
@post = Post.first
@comments = @post.comments.paginate :page => params[:page], :per_page => 10
My problem lies in the view:
<%= will_paginate @comments %>
This generates links like /post/1?page=1
What I need is /post/1/comments?page=1
Is there a way to just tell will_paginate what url helper to use? (like post_comments_path)
Any ideas?
Hi all; I've multiply heard Ruby touted for its super spectacular meta-programming capabilities, and I was wondering if anyone could help me get started with this problem.
I have a class that works as an "archive" of sorts, with internal methods that process and output data based on an input. However, the items in the archive in the class itself are represented and processed with integers, for performance purposes. The actual items outside of the archive are known by their string representation, which is simply number_representation.to_s(36).
Because of this, I have hooked up each internal method with a "proxy method" that converts the input into the integer form that the archive recognizes, runs the internal method, and converts the output (either a single other item, or a collection of them) back into strings.
The naming convention is this: internal methods are represented by _method_name; their corresponding proxy method is represented by method_name, with no leading underscore.
For example:
class Archive
## PROXY METHODS ##
## input: string representation of id's
## output: string representation of id's
def do_something_with id
result = _do_something_with id.to_i(36)
return nil if result == nil
return result.to_s(36)
end
def do_something_with_pair id_1,id_2
result = _do_something_with_pair id_1.to_i(36), id_2.to_i(36)
return nil if result == nil
return result.to_s(36)
end
def do_something_with_these ids
result = _do_something_with_these ids.map { |n| n.to_i(36) }
return nil if result == nil
return result.to_s(36)
end
def get_many_from id
result = _get_many_from id
return nil if result == nil # no sparse arrays returned
return result.map { |n| n.to_s(36) }
end
## INTERNAL METHODS ##
## input: integer representation of id's
## output: integer representation of id's
def _do_something_with id
# does something with one integer-represented id,
# returning an id represented as an integer
end
def do_something_with_pair id_1,id_2
# does something with two integer-represented id's,
# returning an id represented as an integer
end
def _do_something_with_these ids
# does something with multiple integer ids,
# returning an id represented as an integer
end
def _get_many_from id
# does something with one integer-represented id,
# returns a collection of id's represented as integers
end
end
There are a couple of reasons why I can't just convert them if id.class == String at the beginning of the internal methods:
These internal methods are somewhat computationally-intensive recursive functions, and I don't want the overhead of checking multiple times at every step
There is no way, without adding an extra parameter, to tell whether or not to re-convert at the end
I want to think of this as an exercise in understanding ruby meta-programming
Does anyone have any ideas?
edit
The solution I'd like would preferably be able to take an array of method names
@@PROXY_METHODS = [:do_something_with, :do_something_with_pair,
:do_something_with_these, :get_many_from]
iterate through them, and in each iteration, put out the proxy method. I'm not sure what would be done with the arguments, but is there a way to test for arguments of a method? If not, then simple duck typing/analogous concept would do as well.
I'd like to know if there is a way to figure out if a key does something in vim. I know that I can use :map to see user-defined mappings, but is there something for the built-in stuff?
For example, I always had CTRL-W bound to close tab, because I thought that it was unused. After half a year, I found out that there are some sequences that use it, like CTRL-W CTRL-S to split the window, and it was a nightmare to retrain myself.
Hi ,
I have generated a Google map key by login as a [email protected] . Is there any restriction in generating the number of keys for each user. Since we have 2 different domains and i need to generate key for that too.
Actually i am not sure about of how many keys the person who used this id has created..
And is there any way to find of how many keys had already been created for the same account previously???
How can you map say, a square or circle, to a triangle in OpenGL without distortion? I'm not seeing it.
EDIT:
Bonus question: What are some good OpenGL ES tutorials online? Videos and articles count. (I've seen the Stanford University stuff on iTunes U and think it's excellent, but I want more.)
I have a reference to call that may or may not be there. When I add the nullable option it still doing Inner Join when I want an Outer Left Join (show the left even if the right is null). Is this possible in the NH map?
References(x => x.DefaultCategory, "CATEGORY_ID")
.Nullable();
I am using following route map
routes.MapRoute(
"RenderAssociatedForm",
"DoAction/{nodeLevelId}/{nodeSystemId}",
new
{
controller = "FrontEnd",
action = "RenderAssociatedForm",
});
Now nodeLevelId can be anything like zs\bbal. As we know that we should escape '\', so we are using 'zs%5cbbal'. But still the following url is not mapping to this route.
//localhost/DoAction/zs%5cbbal/5
When I try simple Id without the escape character, it maps properly. Can anybody tell me where I am going wrong?
I'm new to Rails and feeling my way, but this has me stumped.
I moved some constants to a separate module ie:
module Fns
Fclick = "function() { alert(\"You clicked the map.\");}\n"
...
end
then in my controller added:
require "fns"
class GeomapController < ApplicationController
def index
fstring = Fns::Fclick
...
end
but when I run the server I get:
uninitialized constant Fns::Fclick
what am I missing?
My table structure is as follows:
Person 1-M PesonAddress
Person 1-M PesonPhone
Person 1-M PesonEmail
Person 1-M Contract
Contract M-M Program
Contract M-1 Organization
At the end of this query I need a populated object graph where each person has their:
PesonAddress's
PesonPhone's
PesonEmail's
PesonPhone's
Contract's - and this has its respective
Program's
Now I had the following query and I thought that it was working great, but it has a couple of problems:
from people in ctx.People.Include("PersonAddress")
.Include("PersonLandline")
.Include("PersonMobile")
.Include("PersonEmail")
.Include("Contract")
.Include("Contract.Program")
where people.Contract.Any(
contract => (param.OrganizationId == contract.OrganizationId)
&& contract.Program.Any(
contractProgram => (param.ProgramId == contractProgram.ProgramId)))
select people;
The problem is that it filters the person to the criteria but not the Contracts or the Contract's Programs. It brings back all Contracts that each person has not just the ones that have an OrganizationId of x and the same goes for each of those Contract's Programs respectively.
What I want is only the people that have at least one contract with an OrgId of x with and where that contract has a Program with the Id of y... and for the object graph that is returned to have only the contracts that match and programs within that contract that match.
I kinda understand why its not working, but I don't know how to change it so it is working...
This is my attempt thus far:
from people in ctx.People.Include("PersonAddress")
.Include("PersonLandline")
.Include("PersonMobile")
.Include("PersonEmail")
.Include("Contract")
.Include("Contract.Program")
let currentContracts = from contract in people.Contract
where (param.OrganizationId == contract.OrganizationId)
select contract
let currentContractPrograms = from contractProgram in currentContracts
let temp = from x in contractProgram.Program
where (param.ProgramId == contractProgram.ProgramId)
select x
where temp.Any()
select temp
where currentContracts.Any() && currentContractPrograms.Any()
select new Person { PersonId = people.PersonId, FirstName = people.FirstName, ..., ....,
MiddleName = people.MiddleName, Surname = people.Surname, ..., ....,
Gender = people.Gender, DateOfBirth = people.DateOfBirth, ..., ....,
Contract = currentContracts, ... }; //This doesn't work
But this has several problems (where the Person type is an EF object):
I am left to do the mapping by myself, which in this case there is quite a lot to map
When ever I try to map a list to a property (i.e. Scholarship = currentScholarships) it says I can't because IEnumerable is trying to be cast to EntityCollection
Include doesn't work
Hence how do I get this to work. Keeping in mind that I am trying to do this as a compiled query so I think that means anonymous types are out.
Is there a way to map an event such as a click-event on this element
<div>Just normal text</div>
to the position in the contained text ( "You just clicked the 6th character", when hitting the 'n' )?
I am using an MKMapView in my iPhone application. When I load this view, the activity monitor instrument shows that the real memory of my App is increasing significantly. It keeps going up as you move the map around or zoom in and out. Once the View controller that loads this view is removed, the memory that was allocated due to the usage of the mapView does not get freed up. Is there something that can be done to get all this memory back?
Hi,
I got a model with 2 fields: latitude and longitude. Right now they're 2 CharFields, but I want to make a custom widget to set it in admin - was thinking about displaying Google Maps, then getting the coordinates of the marker.
But can I have 1 widget (a single map) to set 2 different fields?