Hi all,
I am using iPhone os4 for development. I need to add overlays to mapview. Apple now
provides overlays as a new feature of os4. How can i add overlays.Any help will
be greatly appreciated.
As I have been learning about software development the last 2 years the more I learn, it seems the more gray areas I am running into. One gray area I have issues with right now is trying to decide how many layers an application should have. For example, in a WPF MVVM application what fashion of layering is ok? Is the following too separated? When I mention layering I mean creating a new class library for each layer.
Presentation (View)
View Model
Business Layer
Data Access
Model Layer
Utility Layer
Or for a non MVVM application is this too separated?
Presenation
Business
Data Access
Model Layer
Utility Layer
Is acceptable to run layers together and just create folders for each layer? Any coloring of this gray area would be appreciated.
I need to do something like this,
My two tables have the same signature, but different class so It suppose to work but it is not working.
var myTable;
if (booleanVariable == true)
{
myTable = table1;
}
else
{
myTable = table2;
}
var myLinq1 = from p in myTable
join r in myOtherTable
select p;
In this case, I have to initialize myTable
I have tried also,
var myTablev= table2;
if (booleanVariable == true)
{
myTable = table1;
}
var myLinq1 = from p in myTable
join r in myOtherTable
select p;
then var is type table2, then it can't be changed to table1 type.
I need help, I don't want to make a copy paste of all the code. the linq query is huge, and it s nested with 5 or 6 queries. also I have to do this on 12 different methods.
Thanks a lot for your help.
I need to do something like this,
My two tables have the same signature, but different class so It suppose to work but it is not working.
var myTable;
if (booleanVariable == true)
{
myTable = table1;
}
else
{
myTable = table2;
}
var myLinq1 = from p in myTable
join r in myOtherTable
select p;
In this case, I have to initialize myTable
I have tried also,
var myTable= table2;
if (booleanVariable == true)
{
myTable = table1;
}
var myLinq1 = from p in myTable
join r in myOtherTable
select p;
then var is type table2, then it can't be changed to table1 type.
I need help, I don't want to make a copy paste of all the code. the linq query is huge, and it s nested with 5 or 6 queries. also I have to do this on 12 different methods.
Thanks a lot for your help.
One can autostart an application such that it launches on session start with an xdg desktop file in ~/.config/autostart (or /etc/xdg/autostart).
But my application (a python/gtk/webkit/html5 app) when autostarted has a unity (and a unity-2d) launcher icon that is a gray question mark, even though:
when I find it in dash, the dash shows the icon I specify in my main desktop file (in /usr/share/applications)
when I launch it from dash, the launcher shows the icon I specify in my main desktop file
when I add it as a favorite, the launcher shows the proper icon
There are two cases where I get the gray question mark icon:
autostart
launch from terminal (this use case is not essential though and doesn't involve the desktop file anyway: but should/does ubuntu have an xdg desktop file interpreter à la #!/usr/bin/desktop or something)
So: what is needed such unity (3d/2d) launcher panel shows the icon specified in an autostart desktop file?
I have to mark a certain item in a way that will make it stick-out in the background. I need it to be surrounded with the color that contrasts the background as much as possible so it will pop out and easily noticeable by the player.
Lets say I know the background is color 'x', how do I find 'y' such that it will be very contrasting to 'x' and easy to notice in a background where 'x' is a dominant color?
I first thought about inverting color 'x' and then I noticed that when 'x' is a medium shade of gray, if I invert 'x' to get 'y', then 'y' is also a medium shade of gray which does not work.
Sometimes knowing who, what, where, and when is not such a good thing. Security consultant Diana Kelley explores the dangers of geo-location to your business's information security.
I installed Kubuntu on top of my existing Ubuntu 12.04 (64 bit) installation. During Kubuntu installation, I chose lightdm as my default display manager (instead of kdm).
Now after rebooting, the Grub has a new color (gray instead of default purplish) and the screen while booting is gray (instead of purplish). I am curious if it is possible to change this grub behavior without removing Kubuntu.
I did find a lot of discussion about modifying grub themes but they were not very useful because I do not know what is the default unity grub theme.
I did reinstall grub but it didn't change anything.
I tried the Grub Customizer but couldn't succeed.
Thanks in advance!
The MFC Feature Pack (and VS 2010) adds out-of-the-box support for several "modern" GUI elements (such as MDI with tabbed documents, the ribbon, and a Visual Studio-style interface with docking panels). These are a boon to those of us that have to support legacy MFC-based applications and want to update their look-and-feel, and a sign that Microsoft has not completely abandoned unmanaged C++ development. However, with the push so strongly in favor of .NET, WinForms, and managed code (and for plenty of good reasons), there seems little reason to develop new applications in unmanaged C++/MFC.
The question then becomes how does one obtain these GUI elements in a WinForms application. Almost all of the add-ons and libraries I have found so far cost money, and introduce additional dependencies. I don't have a budget to buy third-party libraries, and the controls provided by Microsoft in MFC for free seem sufficient for our needs. But I still have reservations about learning MFC to develop a new application. Not only does the investment in time seem significant (by all accounts, MFC seems particularly difficult to learn, even for experienced .NET developers--although I am willing to try), but the question of MFC's lifespan is raised as well. Certainly, given the millions of lines of code and existing apps written in native C++, it will be around for some time, but the handwriting seems to be on the wall, so to speak, that it's no longer Microsoft's touted development platform.
It seems like these features should be available by now in WinForms without the need for third-party add-ons, or devoting a lot of time and resources to custom-drawing EVERYTHING. Am I just missing something? I find very little online that compares these new features of MFC to what is available in WinForms, mainly because most everything written on MFC pre-dated its most recent update, before which it looked admitted "dated," and with its other flaws, was hardly an appealing platform for new development. With the very recent release of VS 2010, we have a while to wait before WinForms gets updated again. What routes are you guys taking for applications whose customers demand a modern-looking UI on a budget?
I cannot seem to get a nested form to generate in a rails view for a belongs_to relationship using the new accepts_nested_attributes_for facility of Rails 2.3. I did check out many of the resources available and it looks like my code should be working, but fields_for explodes on me, and I suspect that it has something to do with how I have the nested models configured.
The error I hit is a common one that can have many causes:
'@account[owner]' is not allowed as an instance variable name
Here are the two models involved:
class Account < ActiveRecord::Base
# Relationships
belongs_to :owner, :class_name => 'User', :foreign_key => 'owner_id'
accepts_nested_attributes_for :owner
has_many :users
end
class User < ActiveRecord::Base
belongs_to :account
end
Perhaps this is where I am doing it 'rong', as an Account can have an 'owner', and may 'users', but a user only has one 'account', based on the user model account_id key.
This is the view code in new.html.haml that blows up on me:
- form_for :account, :url => account_path do |account|
= account.text_field :name
- account.fields_for :owner do |owner|
= owner.text_field :name
And this is the controller code for the new action:
class AccountsController < ApplicationController
# GET /account/new
def new
@account = Account.new
end
end
When I try to load /account/new I get the following exception:
NameError in Accounts#new
Showing app/views/accounts/new.html.haml where line #63 raised:
@account[owner] is not allowed as an instance variable name
If I try to use the mysterious 'build' method, it just bombs out in the controller, perhaps because build is just for multi-record relationships:
class AccountsController < ApplicationController
# GET /account/new
def new
@account = Account.new
@account.owner.build
end
end
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.build
If I try to set this up using @account.owner_attributes = {} in the controller, or @account.owner = User.new, I'm back to the original error, "@account[owner] is not allowed as an instance variable name".
Does anybody else have the new accepts_nested_attributes_for method working with a belongs_to relationship? Is there something special or different you have to do? All the official examples and sample code (like the great stuff over at Ryans Scraps) is concerned with multi-record associations.
I am making a mobile webapp in dascode, I used mailto and it pulls up the email client like expected but when you click cancel it goes back to the page and non of my internal links work any ideas on how to fix this?
We have a WEb Service named, let's say Foo.
So there is a Foo.svc file and a code behind Foo.svc.cs.
We add a silverlight project and wish to use the Foo.svc services so we add a Service Reference and call it's namespace FooBar.
This creates the following files :
Reference.cs
Reference.svcmap
Foo.xsd
Foo.disco
configuration.svcinfo
Foo.wsdl
Also various *.datasource files.
Over time we update the Foo.svc and add more Web Services (methods and interfaces) and the number of files in the FooBar directory is growing.
I have 26 Foo(nn).xsd files in this directory - where nn = 1 to 26.
My configuration.svcinfo is upto configuration91.svcinfo.
My question is this? Do any of these files need to be version controlled? Can they all be deleted each time you do a build \ deploy (as long as you do an update service reference)?
I am building a LOB application that has a main section and a TabControl with various TabItems in it. On hitting save the idea is that any fields in error are highlighted and the first field in error gets the focus.
If the first, and only, field in error is on an Unselected tab the tab should then become selected and the field in error should become highlighted and have focus. But I can not get this to work.
What appears to be happening is that the Unselected tab is not in the visual tree so you can't navigate back to the owning TabItem and make it the currently selected TabItem in the TabControl.
Has anyone got an idea on how this can be done\achieved?
I generated a lower triangular matrix, and I want to complete the matrix using the values in the lower triangular matrix to form a square matrix, symmetrical around the diagonal zeros.
lower_triangle = numpy.array([
[0,0,0,0],
[1,0,0,0],
[2,3,0,0],
[4,5,6,0]])
I want to generate the following complete matrix, maintaining the zero diagonal:
complete_matrix = numpy.array([
[0, 1, 2, 4],
[1, 0, 3, 5],
[2, 3, 0, 6],
[4, 5, 6, 0]])
Thanks.
I'm overhauling certain parts of my app to use the new GCM service to replace C2DM. I simply want to create the JSON request from a Java program for testing and then read the response. As of right now I can't find ANY formatting issues with my JSON request and the google server always return code 400, which indicates a problem with my JSON.
http://developer.android.com/guide/google/gcm/gcm.html#server
JSONObject obj = new JSONObject();
obj.put("collapse_key", "collapse key");
JSONObject data = new JSONObject();
data.put("info1", "info_1");
data.put("info2", "info 2");
data.put("info3", "info_3");
obj.put("data", data);
JSONArray ids = new JSONArray();
ids.add(REG_ID);
obj.put("registration_ids", ids);
System.out.println(obj.toJSONString());
I print my request to the eclipse console to check it's formatting
byte[] postData = obj.toJSONString().getBytes();
try{
URL url = new URL("https://android.googleapis.com/gcm/send");
HttpsURLConnection.setDefaultHostnameVerifier(new JServerHostnameVerifier());
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Authorization", "key=" + API_KEY);
System.out.println(conn.toString());
OutputStream out = conn.getOutputStream();
// exception thrown right here. no InputStream to get
InputStream in = conn.getInputStream();
byte[] response = null;
out.write(postData);
out.close();
in.read(response);
JSONParser parser = new JSONParser();
String temp = new String(response);
JSONObject temp1 = (JSONObject) parser.parse(temp);
System.out.println(temp1.toJSONString());
int responseCode = conn.getResponseCode();
System.out.println(responseCode + "");
} catch(Exception e){
System.out.println("Exception thrown\n"+ e.getMessage());
}
}
I'm sure my API key is correct as that would result in error 401, so says the google documentation. This is my first time doing JSON but it's easy to understand because of its simplicity. Anyone have any ideas on why I always receive code 400?
update: I've tested the google server example classes provided with gcm so the problem MUST be with my code.
I have an issue with memory usage relating to images and I've searched the docs and watched the videos from cs193p and the iphone dev site on memory mgmt and performance. I've searched online and posted on forums, but I still can't figure it out.
The app uses core data and simply lets the user associate text with a picture and stores the list of items in a table view that lets you add and delete items. Clicking on a row shows the image and related text. that's it.
Everything runs fine on the simulator and on the device as well. I ran the analyzer and it looked good, so i then starting looking at performance. I ran leaks and everything looked good. My issue is when running Object Allocations as every time i select a row and the view with the image is shown, the live bytes jumps up a few MB and never goes down and my app eventually crashes due to memory usage. Sorting the live bytes column, i see 2 2.72MB mallocs (5.45Mb total), 14 CFDatas (3.58MB total), 1 2.74MB malloc and everything else is real small. the problem is all the related info in instruments is really technical and all the problem solving examples i've seen are just missing a release and nothing complicated. Instruments shows Core Data as the responsible library for all but one (libsqlite3.dylib the other) with [NSSQLCore _prepareResultsFromResultSet:usingFetchPlan:withMatchingRows:] as the caller for all but one (fetchResultSetReallocCurrentRow the other) and im just not sure how to track down what the problem is. i've looked at the stack traces and opened the last instance of my code and found 2 culprits (below). I havent been able to get any responses at all on this, so if anyone has any tips or pointers, I'd really appreciate it!!!!
//this is from view controller that shows the title and image
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.title = item.title;
self.itemTitleTextField.text = item.title;
if ([item.notes length] == 0)
{
self.itemNotesTextView.hidden = YES;
} else
{
self.itemNotesTextView.text = item.notes;
} //this is the line instruments points to
UIImage *image = item.photo.image;
itemPhoto.image = image;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete)
{
// Delete the managed object for the given index path
NSManagedObjectContext *context = [fetchedResultsController managedObjectContext];
[context deleteObject:[fetchedResultsController objectAtIndexPath:indexPath]];
// Save the context.
NSError *error = nil;
if (![context save:&error]) //this is the line instruments points to
{
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
exit(-1);
}
}
}
I've written an app that spins a few threads each of which read several MB of memory. Each thread then connects to the Internet and uploads the data. this occurs thousands of times and each upload takes some time
I'm seeing a situation where (verified with windbg/sos and !dumpheap) that the Byte[] are not getting collected automatically, causing 100/150MB of memory to be reported in task manager
if I call System.GC.Collect() i'm seeing a huge drop in memory, a drop of over 100MB
I dont like calling System.GC.Collect() and my PC has tons of free memory. however if anyone looks at TaskManager they're going to be concerned, thinking my app is leaking horribly.
tips?
Questions needing answers :
Does the finalizer of the client side ServicedComponent call ServicedComponent.DisposeObject or Dispose?
How should destruction (release of memory) occur in the com server in realtion to its usage in the client?
Basically - we are reaching a 2 gig limit on process size (memory) of the COM server as memory is not being released - is the solution to call explicitly call Dispose or use the using statement in the client?
I have an x64 managed C++ class that needs to be tested using Visual Studio 2008. This class links to a x64 unmanaged lib
I'm not able to run my my tests because vstesthost.exe (the exe Visual Studio hosts my test) is x86 and not x64.
Ideas? the error generated is
rror: System.BadImageFormatException: Could not load file or assembly ... or one of its dependencies. An attempt was made to load
I am confounded by the fact that even using different programs (on the same machine) to run /compile, and after nilling the vaues (before and after) the function.. that NO MATTER WHAT.. I'll keep getting the SAME "random" numbers… each and every time I run it. I swear this is NOT how it's supposed to work.. I'm going to illustrate as simply as is possible…
#import <Foundation/Foundation.h>
int main(int argc, char *argv[]) {
int rPrimitive = 0; rPrimitive = 1 + rand() % 50;
NSNumber *rObject = nil; rObject = [NSNumber numberWithInt:rand() % 10];
NSLog(@"%i %@", rPrimitive, rObject);
rPrimitive = 0; rObject = nil;
NSLog(@"%i %@", rPrimitive, rObject);
return 0;
}
Run it in TextMate:
i686-apple-darwin11-llvm-gcc-4.2
8 9
0 (null)
Run it in CodeRunner:
i686-apple-darwin11-llvm-gcc-4.2
8 9
0 (null)
Run it a million times, if you'd like. You can gues what it will always be. Why does this happen? Why oh why is this "how it is"?
Is there an easy way to order MySQL results respectively by WHERE id IN (...) clause?
Example:
SELECT * FROM articles WHERE articles.id IN (4, 2, 5, 9, 3)
to return
Article with id = 4
Article with id = 2
Article with id = 5
Article with id = 9
Article with id = 3
and also
SELECT * FROM articles WHERE articles.id IN (4, 2, 5, 9, 3) LIMIT 2,2
to return
Article with id = 5
Article with id = 9
Is there any way to create a variable, and add an ID to the end of the actual variable name?
I have a variable called 'gauge', used to create a new Gauge object:
var gauge = new Gauge(target).setOptions(opts);
I want to add an ID to the variable, so something like:
var gauge+id = new Gauge(target).setOptions(opts);
It's because I'm creating a number of these objects, and have a specific ID already for each one, which I want to attach to the gauge object if possible?
All my code for this function is below, if it gives you a better idea of what i need to do:
function go(id, votes)
{
var val = $('#votes_'+id).text();
var target = document.getElementById('foo_'+id); // your canvas element
var gauge = new Gauge(target).setOptions(opts); // create sexy gauge!
gauge.maxValue = 100; // set max gauge value
gauge.animationSpeed = 20; // set animation speed (32 is default value)
var a=votes+0.5;
gauge.set(val); // set actual value
}
My main problem arises on the last line. It says gauge.set(val), and it only sets the last object, ignoring all the other ones...
I've got a MainPage.xaml page a Detail.xaml page.
I've passed variables to the Detail.xaml from MainPage.xaml by using a static variable and referencing it in Detail.xaml (the detail page is acting like a dialog). However once I've updated the content of another object, I want to call a method in MainPage.xaml to refresh the content of that page using the updated object from the Detail.xaml page.
I assume I am not using the correct paradigm for this and should probably be using MVVM or something but I'm not familiar with the implementation and was hoping there was a simple way to do this?