thanks for reading. I'm creating a simple web based drawing app that uses speech recognition.
I have created a simple page, the project is on github here: https://github.com/a5hton/speechdraw
It has a 16x16 pixel grid. I would like to be able to draw on this grid by using simple words. For example if you say "right", the pixel to the right will be colored black. If you say "down" the pixel below the last one will be colored black.
You can say up, down, left or right and the corresponding pixels will be colored.
Saying "erase" will switch to erase mode, colouring the pixels back to their original color.
Saying "lift" will lift the pen off the page.
Saying "draw" will enable the draw mode.
Could you please help me work out how to make this happen. Please see the simple page at to get an understanding.
Thank you!
Cheers,
Michael
public static IQueryable<Institution> WithFunds(this IQueryable<Institution> query, IEnumerable<Fund> allowedFunds)
{
return query.
}
I want to get the query to return all Institutions having any of the Fund given in 'allowedFunds' list in Institution.Funds. Please help.
My class hierarchy goes like this.
public partial class Institution
{
public int Id { get; set; }
public virtual ICollection<Fund> Funds { get; set; }
}
public partial class Fund
{
public int Id { get; set; }
public virtual Institution Institution { get; set; }
}
I am implementing a FakeDataSet class by implementing IDbSet interface. As part of implementing this interface, I have to implement Find method. All my entity classes has an Guid type Id column. I am trying to implement Find method for this FakeDbSet class but having hard time to write it in a generic way. Below is my attempts for writing this method but since it does not know about Id been Guid type, I am getting compilation error on m.Id call. Any ideas on how this could be accomplished?
public class FakeDataSet<T> : IDbSet<T> where T: class, new()
{
// Other methods for implementing IDbSet interface
public T Find(params object[] keyValues)
{
var keyValue = (Guid)keyValues.FirstOrDefault();
return this.SingleOrDefault(m => m.Id == keyValue); // How can I write this
}
}
I have a largish array of string that I want to use as a lookup.
I a using in_array(), but I suspect its doing a simple loop through - does anyone know whether the in_array() algo uses a bsearch algo?
I want to implement a code that loops inside an array that its size is set by the user that means that the size isn't constant.
for example:
A=[1,2,3,4,5]
then I want the output to be like this:
[1],[2],[3],[4],[5]
[1,2],[1,3],[1,4],[1,5]
[2,3],[2,4],[2,5]
[3,4],[3,5]
[4,5]
[1,2,3],[1,2,4],[1,2,5]
[1,3,4],[1,3,5]
and so on
[1,2,3,4],[1,2,3,5]
[2,3,4,5]
[1,2,3,4,5]
Can you help me implement this code?
I want to create a url like www.facebook.com/username just like Facebook does it. Can we use mod_rewrite to do it. Username is name of the user in a table. It is not a sub directory. Please advise.
I am creating a Google App Engine server for a project where I receive a large quantity of data via an HTTP POST request.
The data is separated into lines, with 200 characters per line. The number of lines can go into the hundreds, so 10's of thousands of characters total.
What I want to do is concatenate all of those lines into a single Text object, since Strings have a maximum length of 500 characters but the Text object can be as large as 1MB.
Here is what I thought of so far:
public void doPost(HttpServletRequest req, HttpServletResponse resp)
{
...
String[] audioSampleData = new String[numberOfLines];
for (int i = 0; i < numberOfLines; i++)
{
audioSampleData[i] = req.getReader().readLine();
}
com.google.appengine.api.datastore.Text textAudioSampleData = new
Text(audioSampleData[0] + audioSampleData[1] + ...);
...
}
But as you can see, I don't know how to do this without knowing the number of lines before-hand. Is there a way for me to iterate through the String indexes within the Text constructor? I can't seem to find anything on that.
Of note is that the Text object can't be modified after being created, and it must have a String as parameter for the constructor. (Documentation here)
Is there any way to this? I need all of the data in the String array in one Text object.
Many Thanks!
Hi,
i have two models:
class Category
has many :jobs
end
class Job
belongs_to :category
end
So for sure i'm able to do
c = Category.first
c.jobs
My question is: how can i find just categories that has at least one job?
On pageload i want to show all fields in repeater control and on typing licenseid in the textbox i want to show that specific licenceid details
IF I place below code in the datasource of repeater,First one is not working.In the second one i placed a textbox and put its value to 0 on pageload.it is working.But i want both to be working.
SELECT * FROM License WHERE (0 = @selectAll OR LicenseID=@LicenseID) -> Not working
SELECT * FROM License WHERE (0 = @selectAll ) ->working
SELECT * FROM License WHERE (LicenseID=@LicenseID)-> working
Thanks in advance for the help
ASP.NET is changing id, name values according to control's parent control name. That's why i am searching id with JQUERY as below.
// $ is looking to the end of "id" attribute of input elements
$("input[id$='cbAddToNews']")
Only one element is returning by jQuery. But when i want to change the attribute, I'm using this syntax:
$($("input[id$='cbAddToNews']")[0]).show()
Is there any way to do this without wrapping it with $(...[0]) ?
GDD-BR 2010 [2F] Storage, Bigquery and Prediction APIs
Speaker: Patrick Chanezon Track: Cloud Computing Time slot: F [15:30 - 16:15] Room: 2 Level: 101 Google is expanding our storage products by introducing Google Storage for Developers. It offers a RESTful API for storing and accessing data at Google. Developers can take advantage of the performance and reliability of Google's storage infrastructure, as well as the advanced security and sharing capabilities. We will demonstrate key functionality of the product as well as customer use cases. Google relies heavily on data analysis and has developed many tools to understand large datasets. Two of these tools are now available on a limited sign-up basis to developers: (1) BigQuery: interactive analysis of very large data sets and (2) Prediction API: make informed predictions from your data. We will demonstrate their use and give instructions on how to get access.
From:
GoogleDevelopers
Views:
1
0
ratings
Time:
39:27
More in
Science & Technology
I'm trying to learn about grails with Google App Engine and JPA by following a few tutorials:
http://www.morkeleb.com/2009/08/12/grails-and-google-appengine-beginners-guide/
http://inhouse32.appspot.com/index.html
http://grails.org/plugin/app-engine
I've got grails 1.3.0 RC 2, and App Engine SDK 1.3.3, and I'm using Windows 7. The steps that I try are:
grails create-app appname
cd appname
grails install-plugin app-engine. I answer jpa when asked about jdo/jpa. It appears to install the gorm-jpa plugin automatically, although the tutorials all suggest installing gorm-jpa manually.
grails install-plugin gorm-jpa (just in case)
grails create-domain-class test.Person
Edit the grails-app/domain/test/Person.groovy to add name and address fields:
package test
import javax.persistence.*;
// import com.google.appengine.api.datastore.Key;
@Entity
class Person implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Long id
@Basic
String name
@Basic
String address
static constraints = {
id visible:false
}
}
grails generate-all test.Person
I get errors during this final step:
C:\Users\John\Workspaces\STS\appname>grails generate-all test.Person
Welcome to Grails 1.3.0.RC2 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: C:\Users\John\Downloads\grails-1.3.0.RC2\grails-1.3.0.RC2
Base Directory: C:\Users\John\Workspaces\STS\appname
Resolving dependencies...
Dependencies resolved in 493ms.
Running script C:\Users\John\Downloads\grails-1.3.0.RC2\grails-1.3.0.RC2\scripts\GenerateAll.groovy
Environment set to development
[copy] Copied 4 empty directories to 2 empty directories under C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources
[copy] Copied 4 empty directories to 2 empty directories under C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources
[copy] Copied 1 empty directory to 1 empty directory under C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources
[mkdir] Created dir: C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\classes
[groovyc] Compiling 12 source files to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\classes
Note: C:\Users\John\.grails\1.3.0.RC2\projects\appname\plugins\gorm-jpa-0.7.1\src\java\org\grails\jpa\domain\JpaGrailsDomainClass.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
[groovyc] Compiling 8 source files to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\classes
[mkdir] Created dir: C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources\grails-app\i18n
[native2ascii] Converting 13 files from C:\Users\John\Workspaces\STS\appname\grails-app\i18n to C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources\grails-app\i18n
[mkdir] Created dir: C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources\plugins\gorm-jpa-0.7.1\grails-app\i18n
[mkdir] Created dir: C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources\plugins\app-engine-0.8.10\grails-app\i18n
[native2ascii] Converting 1 file from C:\Users\John\.grails\1.3.0.RC2\projects\appname\plugins\gorm-jpa-0.7.1\grails-app\i18n to C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources\plugins\gorm
-jpa-0.7.1\grails-app\i18n
[native2ascii] Converting 1 file from C:\Users\John\.grails\1.3.0.RC2\projects\appname\plugins\app-engine-0.8.10\grails-app\i18n to C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources\plugins\a
pp-engine-0.8.10\grails-app\i18n
[copy] Copying 1 file to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\classes
[copy] Copying 2 files to C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources
[copy] Copied 2 empty directories to 2 empty directories under C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources
[copy] Copying 1 file to C:\Users\John\.grails\1.3.0.RC2\projects\appname
[mkdir] Created dir: C:\Users\John\Workspaces\STS\appname\web-app\plugins\app-engine-0.8.10
[copy] Copying 1 file to C:\Users\John\Workspaces\STS\appname\web-app\plugins\app-engine-0.8.10
[copy] Copying 1 file to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF
[mkdir] Created dir: C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\lib
[copy] Copying 64 files to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\lib
Configuring persistence for AppEngine
[mkdir] Created dir: C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\classes\META-INF
[copy] Copying 1 file to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\classes\META-INF
[mkdir] Created dir: C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\plugins\app-engine-0.8.10
[copy] Copying 2 files to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\plugins\app-engine-0.8.10
[mkdir] Created dir: C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\plugins\gorm-jpa-0.7.1
[copy] Copying 2 files to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\plugins\gorm-jpa-0.7.1
Packaging AppEngine jar files
Enhancing JDO classes
[enhance] DataNucleus Enhancer (version 1.1.4) : Enhancement of classes
[enhance] DataNucleus Enhancer completed with success for 1 classes. Timings : input=589 ms, enhance=200 ms, total=789 ms. Consult the log for full details
[groovyc] Compiling 1 source file to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\classes
[copy] Copying 1 file to C:\Users\John\.grails\1.3.0.RC2\projects\appname
[copy] Copying 1 file to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF
Configuring persistence for AppEngine
Packaging AppEngine jar files
Enhancing JDO classes
[enhance] DataNucleus Enhancer (version 1.1.4) : Enhancement of classes
[enhance] DataNucleus Enhancer completed with success for 1 classes. Timings : input=585 ms, enhance=28 ms, total=613 ms. Consult the log for full details
Generating views for domain class test.Person ...
java.lang.reflect.InvocationTargetException
at SimpleTemplateScript1.run(SimpleTemplateScript1.groovy:43)
at _GrailsGenerate_groovy.generateForDomainClass(_GrailsGenerate_groovy:85)
at _GrailsGenerate_groovy$_run_closure1.doCall(_GrailsGenerate_groovy:50)
at GenerateAll$_run_closure1.doCall(GenerateAll.groovy:42)
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:427)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:415)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.executeTargets(Gant.groovy:590)
at gant.Gant.executeTargets(Gant.groovy:589)
Caused by: java.lang.NoClassDefFoundError: org/hibernate/MappingException
... 15 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.MappingException
at org.codehaus.groovy.tools.RootLoader.findClass(RootLoader.java:156)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:128)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 15 more
Error running generate-all: null
What am I doing wrong?
I'm trying to learn about grails with Google App Engine and JPA by following a few tutorials:
http://www.morkeleb.com/2009/08/12/grails-and-google-appengine-beginners-guide/
http://inhouse32.appspot.com/index.html
http://grails.org/plugin/app-engine
I've got grails 1.3.0 RC 2, and App Engine SDK 1.3.3, and I'm using Windows 7. The steps that I try are:
grails create-app appname
cd appname
grails install-plugin app-engine. I answer jpa when asked about jdo/jpa. It appears to install the gorm-jpa plugin automatically, although the tutorials all suggest installing gorm-jpa manually.
grails install-plugin gorm-jpa (just in case)
grails create-domain-class test.Person
Edit the grails-app/domain/test/Person.groovy to add name and address fields:
package test
import javax.persistence.*;
// import com.google.appengine.api.datastore.Key;
@Entity
class Person implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Long id
@Basic
String name
@Basic
String address
static constraints = {
id visible:false
}
}
grails generate-all test.Person
I get errors during this final step:
C:\Users\John\Workspaces\STS\appname>grails generate-all test.Person
Welcome to Grails 1.3.0.RC2 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: C:\Users\John\Downloads\grails-1.3.0.RC2\grails-1.3.0.RC2
Base Directory: C:\Users\John\Workspaces\STS\appname
Resolving dependencies...
Dependencies resolved in 493ms.
Running script C:\Users\John\Downloads\grails-1.3.0.RC2\grails-1.3.0.RC2\scripts\GenerateAll.groovy
Environment set to development
[copy] Copied 4 empty directories to 2 empty directories under C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources
[copy] Copied 4 empty directories to 2 empty directories under C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources
[copy] Copied 1 empty directory to 1 empty directory under C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources
[mkdir] Created dir: C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\classes
[groovyc] Compiling 12 source files to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\classes
Note: C:\Users\John\.grails\1.3.0.RC2\projects\appname\plugins\gorm-jpa-0.7.1\src\java\org\grails\jpa\domain\JpaGrailsDomainClass.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
[groovyc] Compiling 8 source files to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\classes
[mkdir] Created dir: C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources\grails-app\i18n
[native2ascii] Converting 13 files from C:\Users\John\Workspaces\STS\appname\grails-app\i18n to C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources\grails-app\i18n
[mkdir] Created dir: C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources\plugins\gorm-jpa-0.7.1\grails-app\i18n
[mkdir] Created dir: C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources\plugins\app-engine-0.8.10\grails-app\i18n
[native2ascii] Converting 1 file from C:\Users\John\.grails\1.3.0.RC2\projects\appname\plugins\gorm-jpa-0.7.1\grails-app\i18n to C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources\plugins\gorm
-jpa-0.7.1\grails-app\i18n
[native2ascii] Converting 1 file from C:\Users\John\.grails\1.3.0.RC2\projects\appname\plugins\app-engine-0.8.10\grails-app\i18n to C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources\plugins\a
pp-engine-0.8.10\grails-app\i18n
[copy] Copying 1 file to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\classes
[copy] Copying 2 files to C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources
[copy] Copied 2 empty directories to 2 empty directories under C:\Users\John\.grails\1.3.0.RC2\projects\appname\resources
[copy] Copying 1 file to C:\Users\John\.grails\1.3.0.RC2\projects\appname
[mkdir] Created dir: C:\Users\John\Workspaces\STS\appname\web-app\plugins\app-engine-0.8.10
[copy] Copying 1 file to C:\Users\John\Workspaces\STS\appname\web-app\plugins\app-engine-0.8.10
[copy] Copying 1 file to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF
[mkdir] Created dir: C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\lib
[copy] Copying 64 files to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\lib
Configuring persistence for AppEngine
[mkdir] Created dir: C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\classes\META-INF
[copy] Copying 1 file to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\classes\META-INF
[mkdir] Created dir: C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\plugins\app-engine-0.8.10
[copy] Copying 2 files to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\plugins\app-engine-0.8.10
[mkdir] Created dir: C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\plugins\gorm-jpa-0.7.1
[copy] Copying 2 files to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\plugins\gorm-jpa-0.7.1
Packaging AppEngine jar files
Enhancing JDO classes
[enhance] DataNucleus Enhancer (version 1.1.4) : Enhancement of classes
[enhance] DataNucleus Enhancer completed with success for 1 classes. Timings : input=589 ms, enhance=200 ms, total=789 ms. Consult the log for full details
[groovyc] Compiling 1 source file to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF\classes
[copy] Copying 1 file to C:\Users\John\.grails\1.3.0.RC2\projects\appname
[copy] Copying 1 file to C:\Users\John\Workspaces\STS\appname\web-app\WEB-INF
Configuring persistence for AppEngine
Packaging AppEngine jar files
Enhancing JDO classes
[enhance] DataNucleus Enhancer (version 1.1.4) : Enhancement of classes
[enhance] DataNucleus Enhancer completed with success for 1 classes. Timings : input=585 ms, enhance=28 ms, total=613 ms. Consult the log for full details
Generating views for domain class test.Person ...
java.lang.reflect.InvocationTargetException
at SimpleTemplateScript1.run(SimpleTemplateScript1.groovy:43)
at _GrailsGenerate_groovy.generateForDomainClass(_GrailsGenerate_groovy:85)
at _GrailsGenerate_groovy$_run_closure1.doCall(_GrailsGenerate_groovy:50)
at GenerateAll$_run_closure1.doCall(GenerateAll.groovy:42)
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:427)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:415)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.executeTargets(Gant.groovy:590)
at gant.Gant.executeTargets(Gant.groovy:589)
Caused by: java.lang.NoClassDefFoundError: org/hibernate/MappingException
... 15 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.MappingException
at org.codehaus.groovy.tools.RootLoader.findClass(RootLoader.java:156)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:128)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 15 more
Error running generate-all: null
What am I doing wrong?
I am using the Google Maps API with parts in javascript and others in PHP.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Google Maps AJAX + mySQL/PHP Example
//
var iconBlue = new GIcon();
iconBlue.image = 'icon.png';
iconBlue.shadow = '';
iconBlue.iconSize = new GSize(19, 19);
iconBlue.shadowSize = new GSize(22, 20);
iconBlue.iconAnchor = new GPoint(6, 20);
iconBlue.infoWindowAnchor = new GPoint(5, 1);
var iconRed = new GIcon();
iconRed.image = 'icon.png';
iconRed.shadow = '';
iconRed.iconSize = new GSize(19, 19);
iconRed.shadowSize = new GSize(22, 20);
iconRed.iconAnchor = new GPoint(6, 20);
iconRed.infoWindowAnchor = new GPoint(5, 1);
var customIcons = [];
customIcons["restaurant"] = iconBlue;
customIcons["bar"] = iconRed;
function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.setMapType(G_SATELLITE_MAP);
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(47.614495, -122.341861), 13);
// Change this depending on the name of your PHP file
GDownloadUrl("phpsqlajax_genxml.php", function(data) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var name = markers[i].getAttribute("name");
var address = markers[i].getAttribute("address");
var type = markers[i].getAttribute("type");
var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
var marker = createMarker(point, name, address, type);
map.addOverlay(marker);
}
});
}
}
function createMarker(point, name, address, type) {
var marker = new GMarker(point, customIcons[type]);
var html = "<b>" + name + "</b> <br/>" + address;
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
//]]>
(I suppose the php will be called by "GDownloadUrl("phpsqlajax_genxml.php", function(data) {
..." in the javascript part of the sourcecode of phpsqlajax_map.htm)
Now I need another php file and the code snipplets for it, which creates an input form where I can add some new locations to the google map. Following code is used to create the xml file here: http://detektors.de/maptest/phpsqlajax_genxml.php
The next step would be, trying to make an plugin for wordpress that I could easily post a blog entry with a new location on the same map, which displays already some other locations stored in the mysql database.
thanks!
<?php
require("phpsqlajax_dbinfo.php");
function parseToXML($htmlStr)
{
$xmlStr=str_replace('<','<',$htmlStr);
$xmlStr=str_replace('','>',$xmlStr);
$xmlStr=str_replace('"','"',$xmlStr);
$xmlStr=str_replace("'",''',$xmlStr);
$xmlStr=str_replace("&",'&',$xmlStr);
return $xmlStr;
}
// Opens a connection to a MySQL server
$connection=mysql_connect ($host, $username, $password);
if (!$connection) {
die('Not connected : ' . mysql_error());
}
// Set the active MySQL database
$db_selected = mysql_select_db($database, $connection);
if (!$db_selected) {
die ('Can\'t use db : ' . mysql_error());
}
// Select all the rows in the markers table
$query = "SELECT * FROM markers WHERE 1";
$result = mysql_query($query);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
header("Content-type: text/xml");
// Start XML file, echo parent node
echo '';
// Iterate through the rows, printing XML nodes for each
while ($row = @mysql_fetch_assoc($result)){
// ADD TO XML DOCUMENT NODE
echo '';
}
// End XML file
echo '';
?
Hey guys,
I came across a problem I cannot solve on my own concerning the downloadable csv formatted trends data files from Google Insights for Search.
I'm to lazy to reformat the files I4S gives me manually what means: Extracting the section with the actual trends data and reformatting the columns so that I can use it with a modelling program I do for school.
So I wrote a tiny script the should do the work for me: Taking a file, do some magic and give me a new file in proper format.
What it's supposed to do is reading the file contents, extracting the trends section, splitting it by newlines, splitting each line and then reorder the columns and maybe reformat them.
When looking at a untouched I4S csv file it looks normal containing CR LF caracters at line breaks (maybe thats only because I'm using Windows).
When just reading the contents and then writing them to a new file using the script wierd asian characters appear between CR and LF. I tried the script with a manually written similar looking file and even tried a csv file from Google Trends and it works fine.
I use Python and the script (snippet) I used for the following example
looks like this:
# Read from an input file
file = open(file,"r")
contents = file.read()
file.close()
cfile = open("m.log","w+")
cfile.write(contents)
cfile.close()
Has anybody an idea why those characters appear??? Thank you for you help!
I'll give you and example:
First few lines of I4S csv file:
Web Search Interest: foobar
Worldwide; 2004 - present
Interest over time
Week foobar
2004-01-04 - 2004-01-10 44
2004-01-11 - 2004-01-17 44
2004-01-18 - 2004-01-24 37
2004-01-25 - 2004-01-31 40
2004-02-01 - 2004-02-07 49
2004-02-08 - 2004-02-14 51
2004-02-15 - 2004-02-21 45
2004-02-22 - 2004-02-28 61
2004-02-29 - 2004-03-06 51
2004-03-07 - 2004-03-13 48
2004-03-14 - 2004-03-20 50
2004-03-21 - 2004-03-27 56
2004-03-28 - 2004-04-03 59
Output file when reading and writing contents:
Web Search Interest: foobar
??????????? ? ? ? ?????????
????????? ???? ??????
Week foobar
?? ?? ?? ? ? ? ?? ??? ?????
2004-01-11 - 2004-01-17 44
?? ?? ???? ? ? ?? ?????????
2004-01-25 - 2004-01-31 40
?? ?? ?? ? ? ? ?? ?? ??????
2004-02-08 - 2004-02-14 51
?? ?? ???? ? ? ?? ?????????
2004-02-22 - 2004-02-28 61
?? ?? ???? ? ? ?? ?? ??????
2004-03-07 - 2004-03-13 48
?? ?? ???? ? ? ?? ??? ?? ??
2004-03-21 - 2004-03-27 56
?? ?? ???? ? ? ?? ?? ??????
2004-04-04 - 2004-04-10 69
?? ?? ???? ? ? ?? ?????????
2004-04-18 - 2004-04-24 51
?? ?? ???? ? ? ?? ?? ??????
2004-05-02 - 2004-05-08 56
?? ?? ?? ? ? ? ?? ?????????
2004-05-16 - 2004-05-22 54
?? ?? ???? ? ? ?? ?????????
2004-05-30 - 2004-06-05 74
?? ?? ?? ? ? ? ?? ?????????
2004-06-13 - 2004-06-19 50
?? ?? ??? ? ? ?? ?????????
2004-06-27 - 2004-07-03 58
?? ?? ?? ? ? ? ?? ??? ?????
2004-07-11 - 2004-07-17 59
?? ?? ???? ? ? ?? ?????????
I want to print out a web page that seems to be unprintable in both Firefox and Chrome.
It is multiple pages but when I print it out in Firefox and Chrome, they only print the first page. The only way I have found to print out the page is to print it in IE in XPS Document Writer format.
Is there a tool (e.g., web browser or web browser plugin) that will help? Or is there a setting I can use in Firefox or Chrome?
I'm looking for a Chrome extension / add-on that's like DownThemAll in functionality.
Basically an add-on that will allow me to bulk download files with the same extension and/or pattern from a web page with a single click.
Does anyone know if Chrome now has such extensions?
I need to send emails from my social service (this is continuation of Experiences in mailing to registered users). I got strong feeling that it's better to avoid problems with email server configuration and maintance and to choose email provider which will take care of all painful problems.
So several offers were compared: http://imgur.com/JkK2X.jpg
Three of them look very attractive: Postageapp / Sendgrid / CritSend
As alternative i'm considering setup GAE app.
Email provider is quite easy to start work with, but have no idea how much effort require GAE to integrate with PHP.
So my question is: which option is better to choose:
email provider
GAE
?
Two factors are important here:
business background (therefore prices are mentioned),
work required to setup and maintain desired solution.
Preferably i would love to avoid all email-related problems (like black lists and so on).
I dunno what exactly it's called, by cache refresh I mean, refresh the page after clearing its cache. I don't want to clear the entire browser cache.
I prefer Chrome's Dev panel against firebug... don't ask me why. But I can't seem to cache refresh my pages. In FF, I know it to be Shift+Refresh.
In chrome, I've tried Ctrl+R, Ctrl+Refresh, Alt+Refresh, Shift+Refresh but none of them work.
EDIT: I got a Notable Question Badge for the lamest question I've ever asked. FML.
I'm using Windows Mail (which uses the windows contact store behind the scenes) to connect to the gmail imap server. I would like to have my gmail contacts available to me when using Mail.
How can I set up a two-way sync to automatically sync the Windows Contact store with Gmail Contacts?
Please note: there seems to be a lot of resources for how to sync to outlook, these solutions wouldn't work for me as I'm not using outlook.
I have an HP Mini 110 with Splashtop OS as an 'instant on' OS. I've updated to the newest version which has a Chromium browser...and not too much else
You know what would be really cool? The newest Chromium/Chrome OS build on there instead
Can someone in the know tel me if this is even possible?
(just to be clear, I don't want to put Chrome OS on my hard drive or boot to a USB drive. I want Chrome OS installed in the same place that Splashtop is installed.)
Using empathy in Ubuntu 10.04 (64 bit), everything worked great after initial setup. But after disconnecting and reconnecting, any Jabber connection (GTalk and Facebook Chat) gives a 'network error'.
Tried disabling accounts and only connecting to GTalk, same error. Tried removing all accounts, adding GTalk, same error. Upgraded to the dev version of Empathy, connected once, then after going 'offline' and reconnecting, same error.
If it just didn't work, I'd wait for some kind of fix. But it did work, but only once per install. How does that happen?
Anyone with this problem that solved it?
I've been using Gtalk from the beginning, usually with the clients Adium and iChat, but suddenly my account stop working for those clients and other external services like meebo.com, the weird thing (for me) is that my username and password is fine since I can login without problems to any other service like Gmail, and from there I can use talk, the windows official client also works, any clues on what's going on?