So I made my first iphone application; I want to test for memory leaks and the general feel and design of the user interface, so how do I put it on my iphone?
With the latest changes to the developer agreement by Apple, how inherant is the risk of using any kind of framework to develop Apps for devices now? Should shops risk using things like MonoTouch, Three20, Appcelerator since this change?
How are some iPhone/iPad developers here handling it?
http://www.pcworld.com/article/193916/apples_new_iphone_app_policy_unreasonable_and_unjustifiable.html
http://www.wired.com/gadgetlab/2010/04/iphone-flash-policy-steve-jobs/
http://37signals.com/svn/posts/2273-five-rational-arguments-against-apples-331-policy
I'd like to use a CDateTimeCtrl to allow the user to select a non-weekend date. So, if the user increments the day (via a keypress) - and the resulting day is found to fall on a weekend - then the control should skip forward to the following Monday (don't let issues about month changes distract you, it's not relevant).
Usually it's not a problem: when I handle the DTN_DATETIMECHANGE notification I can check the new date/time and if it's found to be a weekend then I can call SetTime on the control to update the date. However, if I set the style to DTS_SHOWNONE, this call to SetTime causes the control to shift the input 'focus' (term used loosely) to the 'none' checkbox, e.g. away from the day field. This prevents the user from using keyboard input to continue incrementing the date unless they subsequently use the right arrow key to reset the 'focus', which is just nasty.
I would dearly like to prevent this focus shift from occurring. Is it even possible?
How can I reduce the amount of similar commands into a loop?
Something like
pictureBox7.BackColor = Color.FromArgb(187, 187, 187);
pictureBox9.BackColor = Color.FromArgb(187, 187, 187);
pictureBox10.BackColor = Color.FromArgb(187, 187, 187);
pictureBox11.BackColor = Color.FromArgb(187, 187, 187);
pictureBox12.BackColor = Color.FromArgb(187, 187, 187);
pictureBox13.BackColor = Color.FromArgb(187, 187, 187);
G2g for now, will add on later.
Trying to figure out how to install rails plugins manually on windows so I have a few questions.
What does the directory need to be named in vendor/plugins? Is it arbitrary or is it linked to something within the plugin config files or is that what you set in the environment.rb?
Once I've copied the files to the correct directory, do I always need to run something inside like init.rb or is it good to go?
What's the difference between 'require' and 'include'?
Thanks!
Consider this very simple logging class:
class MockLog
def self.log_stub_method(*args)
args.each do |a|
define_method "#{a}" do |msg|
t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
$stderr.puts "[#{a.upcase}] \u00bb [#{t}] #{msg}"
end
end
end
log_stub_method :fatal, :error, :warn, :info, :debug
end
Let's add logging to all our classes:
class Module
def has_logging()
class_eval {
@log = MockLog.new
def log
self.class.instance_variable_get :@log
end
}
end
end
Now, why doesn't this work?
class Foo
has_logging
end
Foo.new.log.nil? # => false, as expected
class Bar < Foo
end
Bar.new.log.nil? # => true?! Why wasn't the `log` method inherited?
i have done like:
my($sec,$min,$hour,$day,$month,$yr19,@rest)= localtime(time);
print "##########################" ;
print "\nDate:\t$day-".++$month. "-".($yr19+1900). "\n";
print "Time:\t".sprintf("%02d",$hour). ":".sprintf("%02d",$min). ":".sprintf("%02d",$sec)."\n";
it gives me wrong $day , $min and $sec
my timezone is IST,
is there any alternative to this ?
Hi,
I am trying to have an EditText widget next to a button with a text view underneath. The EditText should resize and fill the screen accordingly, while the button's width is always only what it needs to be by setting the width to wrap_content.
The layout should not be relative. Below is the code I have so far some of which was found here on StackOverflow. Removing the text view gives the desired appearance for the EditText and button, but when the TextView is added the view goes to ... well.
Not sure why the code is not showing? I put it into a < code< pre block without success.
http://pastebin.com/WgH6qrTm
Added the for the facebook badge to the site and now it's thrown my placement for the footer off .. it's working fine in Chrome, but IE, FFox and Opera all experiencing problems...
Here is a screenshot:
The footer (brown bar) is supposed to be at the bottom...
Here is the CSS :
/* footer */
#footer{
background:url(../images/bg-footer.png) no-repeat;
height:26px;
overflow:hidden;
padding:35px 0 0 55px;
font-size:11px;
}
#footer p{
margin:0;
display:inline;
color:#766623;
}
#footer ul{
margin:0;
padding:0;
list-style:none;
display:inline;
}
#footer li{
display:inline;
background:url(../images/sep-f-nav.gif) no-repeat 100% 55%;
padding:0 6px 0 0;
position:relative;
}
* html #footer li{
padding:0 3px 0 3px;
}
*+html #footer li{
padding:0 3px 0 3px;
}
#footer a{
color:#30481f;
text-decoration:none;
}
#footer a:hover{
text-decoration:underline;
/*Facebook badge Holder*/
.fb-area{
width:287px;
padding:0 0;
margin:0 0;
min-height:100%;
}
Again i rewrite my question with more details i.e. I am developing a website in Asp.net 2.0 in that i'm tracking the user's some details like their id,no of page hitted and time of hitting etc, in a LogfileDate(the LogfileDate contains whole day summary of all users) saved inside a folder(Folder is inside my project). And at another day when a new logfileDate created i want to mail the previous day Logfile and delete that file after sending. Everything happened but when It is going to delete its shows file is accessed by another process. So I need to refresh that folder after sending mail so that it got free with buffer. I'm not using IIS and i dont want it to use.
I have a text file made of 3 lines:
Line 1
Line 3
(Line 1, a blank line, and Line 3)
vector<string> text;
vector<string>::iterator it;
ifstream file("test.txt");
string str;
while (getline(file, str))
{
if (str.length() == 0)
str = "\n";
// since getline discards the newline character, replacing blank strings with newline
text.push_back(str);
} // while
for (it=text.begin(); it < text.end(); it++)
cout << (*it);
Prints out:
Line 1
Line 3
I'm not sure why the string with only a newline was not printed out. Any help would be appreciated. Thanks.
Hello,
I am trying to access a Linux system's NOR flash memory. I tried use __raw_readl(xxxxx) (through io_p2v) to read NOR memory data, but I failed.
Is there any way I can access that memory?
Will driver /dev/mem work for this? I guess not. it is only for the RAM maybe.
Can anyone help?
What's the best way to prevent a dictionary attack? I've thought up several implementations but they all seem to have some flaw in them:
Lock out a user after X failed login attempts. Problem: easy to turn into a denial of service attack, locking out many users in a short amount of time.
Incrementally increase response time per failed login attempt on a username. Problem: dictionary attacks might use the same password but different usernames.
Incrementally increase response time per failed login attempt from an IP address. Problem: easy to get around by spoofing IP address.
Incrementally increase response time per failed login attempt within a session. Problem: easy to get around by creating a dictionary attack that fires up a new session on each attempt.
I'm using Doctrine 2 with my Zend Framework application and a typical query result could yield a million (or more) search results.
I want to use Zend_Paginator in line with this result set. However, I don't want to return all the results as an array and use the Array adapter as this would be inefficient, instead I would like to supply the paginator the total amount of rows then and array of results based on limit/offset amounts.
Is this doable using the Array adapter or would I need to create my own pagination adapter?
I have the following at the top of my view:
<%= GMap.header %>
Heroku is giving me an ActionView::TemplateError on that line.... this works on my own machine but not on Heroku.... why is that? Is there something about Heroku that doesn't allow?
In the final compile on the browser, the above code translates into this on the client side:
<script src="http://maps.google.com/maps?file=api&v=2.x&key=XXXXX;hl=&sensor=false" type="text/javascript">
</script>
<script src="/javascripts/ym4r-gm.js" type="text/javascript"></script>
I need to access the users location in this method contained in the mainViewController
-(void)loadAnnotations{
[mapView removeAnnotations:mapView.annotations];
CLLocationCoordinate2D workingCoordinate;
workingCoordinate.latitude= //here i need the users latitude
workingCoordinate.longitude= //here i need the users longitude
NSLog(@" this is %@", workingCoordinate.latitude);
iProspectLiteAnnotation *tempMine = [[iProspectLiteAnnotation alloc] initWithCoordinate:workingCoordinate];
[tempMine setTitle:@"Present Location"];
[tempMine setAnnotationType:iProspectLiteAnnotationTypeUser];
[mapView addAnnotation:tempMine];
}
however the mainViewController is already set to
<fipsideViewControllerDelegate>
What should I add to the header file and the implementation file to poll the location Manager for the users current latitude and longitude?
for (Player p : players)
{
p.addCard(deck.dealCard());
p.addCard(deck.dealCard());
}
and
for (int i = 0; i < players.size() ; i++)
{
Player p = players.get(i);
p.addCard(deck.dealCard());
p.addCard(deck.dealCard());
}
The second code yeilds a null pointer exception, what can be done to make the bottom one equivalent ?
No matter the cin it continues to to output 0 for score. Why is that? I tried returning the "return 0;" but still no go :/
#include "stdafx.h"
#include <iostream>
using namespace std;
// Variables
int enemiesKilled;
const int KILLS = 150;
int score = enemiesKilled * KILLS;
int main()
{
cout << "How many enemies did you kill?" << endl;
cin >> enemiesKilled;
cout << "Your score: " << score << endl;
return 0;
}
//Table select
$("#reports-table tr").click(
function() {
var detail_id = $(this).attr('id');
$(this).addClass("selected");
$(this).siblings().removeClass("selected");
$('#reports-right').show().load('/members/details/'+detail_id);
$('#reports-table').width(680);
}
);
I currently am using this code to add a selected class to a table row and show details of the row clicked in a right 'aside'. The problem is, I have action buttons in the row--when they are clicked, becausee they are children of the tr, this function still runs...
How can I exclude a certain class?
I don't even know if that's the right term.
May it be known that I'm a major novice!
I have three tables: users, profiles, and survey. Each one has user_id as it's first field, (auto-increment for users), and they're all tied by a foreign key constraint, CASCADE on DELETE.
Currently, for each user, let's say user_id 1, they have a corresponding db entry in the other tables. For profiles it lists all their information, and the survey table holds all their survey information.
Now I must change things...darn scope creep. Users need the ability to have multiple survey results. I imagine that this would be similar to a comment table for a blog...
My entire app runs around the idea that a single user is linked to a constraining profile and survey.
How should I structure my db?
How should I design my app's db so that a user can have multiple tests/profiles for the test?
Please assist! Any advice, information and personal-knowledge is appreciated!
Right now the only way I know how to accompany my client is to create a pseudo-user for each test (so unnecessary) and list them in a view table (called "your tests")-- these are obtained from the db by saying: where user_id=manager_id
I have a standard query that gets the current user object:
@user = User.find_by_email(session[:email])
but I'm putting it as the first line in every single controller action which is obviously not the best way to do this. What is the best way to refactor this?
Do I put this as a method in the Application controller (and if so, can you just show me a quick example)?
Do I put the entire @user object into the session (has about 50 columns and some sensitive ones like is_admin)?
Or is there another way to remove this kind of redundancy?
I have this design:
public interface IFactory<T> {
T Create();
T CreateWithSensibleDefaults();
}
public class AppleFactory : IFactory<Apple> { ... }
public class BananaFactory : IFactory<Banana> { ... }
// ...
The fictitious Apple and Banana here do not necessarily share any common types (other than object, of course).
I don't want clients to have to depend on specific factories, so instead, you can just ask a FactoryManager for a new type. It has a FactoryForType method:
IFactory<T> FactoryForType<T>();
Now you can invoke the appropriate interface methods with something like FactoryForType<Apple>().Create(). So far, so good.
But there's a problem at the implementation level: how do I store this mapping from types to IFactory<T>s? The naive answer is an IDictionary<Type, IFactory<T>>, but that doesn't work since there's no type covariance on the T (I'm using C# 3.5). Am I just stuck with an IDictionary<Type, object> and doing the casting manually?
So i am working on a project and need some advice.
I have a MySQL database that stores events, i know how to code this functionality in PHP but im just stuck of a few specifics.
As the project that I am creating is a timetable, the most important attributes are the day of the event, starting time and finishing time.
Once i have read this data from the MYSQL database using my PHP script, how do i go about inserting these events in to a html timetable?
Lets say i have record like below in my events table:
Event ID = 01
Event Day = Monday
Event Start = 12:00
Event End = 14:00
How would I then put that into a html table, bearing in mind that i may have mutiple events for a day?
I hosted a QWinWidget in a CView and want it to stay at a designated position when resizing. But QWinWidget always moves to (0, 0), i.e. left-top corner of the CView.
I tried to debug in this way:
QWinWidget* pWidget = new QWinWidget(pCView);
pWidget->move(50, 50);
QPoint pos = pWidget->pos();
Note that: the pos is always (0, 0).
Why is that?
I can't get around an issue instantiating a new class by using a string variable and PHP 5.3. namespaces. For example, this works;
$class = 'Reflection';
$object = new $class();
However, this does not;
$class = '\Application\Log\MyClass';
$object = new $class();
A fatal error gets thrown stating the class cannot be found. However it obviously can be instantiated if using the FQN i.e.;
$object = new \Application\Log\MyClass;
I've found this to be aparrent on PHP 5.3.2-1 but not not in later versions. Is there a work around for this?