i have bunch of log files and I have to delete the files of some small sizes, which were erroneous files that got created. ( 63bytes ).
I have to copy only those files which have data in it .
I create a rightBarButtonItem with this method :
- (UIBarButtonItem *)customBarButtonWithSelector:(SEL)callback {
UIButton *customButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
customButton.bounds = CGRectMake(0, 0, 30.0f, 30.0f);
return [[[UIBarButtonItem alloc] initWithCustomView:customButton] autorelease];
}
At execution time the selector is fired when the bar is touched outside the button (near the middle).
Is there a way to restrict the event responder in the defined bounds or in a acceptable range ?
Hi,
I am creating hotel booking system which requires lots of modal dialogs. For this purpose I am using jqueryUI dialog widget. yesterday I embedded it on one of the features of application but this time when dialog opens upon click then its Header is very large about 300-400px in height where as normal header is about 40px in height. Everywhere in the application it is still working fine but at only place it is giving such error. Css is also identical at all places. If anybody knows how to fix this issue then please post here.
Thanks
Ayaz Alavi
I'm looking for a nice stackoverflow-style answer to the first question in this old blog post, which I'll repeat below:
"I’d really like some tool (ideally, g++ based) that shows me what parts of compiled/linked code are generated from what parts of C++ source code. For instance, to see whether a particular template is being instantiated for hundreds of different types (fixable via a template specialization) or whether code is being inlined excessively, or whether particular functions are larger than expected."
I need to display 2d images in opengl using textures.
The image dimensions are not necessarily powers of 2.
I thought of creating a larger texture and restricting the display to the part I was using but the image data will be shared with openCV so I don't want to copy data a pixel at a time into a larger texture.
EDIT - it turns out that even the simplest Intel on board graphics under Windows supports none-power-of-2 textures.
I'm curious what a reasonable / typical value is for the ratio of test code to production code when people are doing TDD. Looking at one component, I have 530 lines of test code for 130 lines of production code. Another component has 1000 lines of test code for 360 lines of production code. So the unit tests are requiring roughly 3x to 5x as much code. This is for Javascript code. I don't have much tested C# code handy, but I think for another project I was looking at 2x to 3x as much test code then production code.
It would seem to me that the lower that value is, assuming the tests are sufficient, would reflect higher quality tests. Pure speculation, I just wonder what ratios other people see.
I know lines of code is an loose metric, but since I code in the same style for both test and production (same spacing format, same ammount of comments, etc) the values are comparable.
I have the following Xaml (simplified for brevity, but will repro the problem in Xamlpad or Kaxaml):
<DockPanel Width="400">
<TextBlock DockPanel.Dock="Left" TextWrapping="Wrap">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Vestibulum massa metus, ornare in fringilla nec, fringilla at orci.
Nunc pharetra enim sit amet sapien aliquet eu euismod turpis vehicula.
Aenean gravida tempus lectus ut ornare.
Nullam massa augue, suscipit vel consectetur fringilla, pretium vitae neque.
</TextBlock>
<Button MinWidth="100" VerticalAlignment="Center" HorizontalAlignment="Left">Hello world</Button>
</DockPanel>
My problem is that I want the Button to take its minimum 100px of space, and for the text to wrap suitably to leave that space. However, what happens is that the text wraps as close to 400px as possible, and then the Button is clipped.
If I Snoop the output I can see that the button is rendering at the desired 100px, but it's being clipped off the side of the DockPanel.
If I reverse the Dock (so the button is docked "Right" and the TextBlock fills) then I get the layout I want, but unfortunately that's not an option due to the surrounding layout.
Is there something I can do that will make the DockPanel a) not clip and b) layout in a way that respects the MinWidth? Or am I stuck finding an alternative layout mechanism?
Thanks in advance!
Around how much space does a Sharepoint Collaboration Portal use up by default (when newly created)?
Just asking because I had one created but I'm thinking of using a Team Site site template--if the client won't be utilizing the default "features" of a Collaboration Portal.
Can I configure my C# application to limit its memory consumption to, say, 200MB?
IOW, I don't want to wait for the automatic GC (which seems to allow the heap to grow much more than actually needed by this application).
I know that in Java there's a command line switch you can pass to the JVM that achieves this.. is there an equivalent in C#?
p.s.
I know that I can invoke the GC from code, but that's something I would rather not have to do periodically. I'd rather set it once upon startup somehow and forget it.
I'm building a system using django, Sphinx and MySQL that's very quickly becoming quite large. The database currently has about 2000 rows, and I've written a program that's going to populate it with another 40,000 rows in a couple days. Since the database is live right now, and since I've never had a database with this much information in it, I'm worried about some things:
Is adding all these rows going to seriously degrade the efficiency of my django app? Will I need to go back through it and optimize all my database calls so they're doing things more cleverly? Or will this make the database slow all around to the extent that I can't do anything about it at all?
If you scoff at my 40k rows, then, my next question is, at what point SHOULD I be concerned? I will likely be adding another couple hundred thousand soon, so I worry, and I fret.
How is sphinx going to feel about all this? Is it going to freak out when it realizes it has to index all this data? Or will it be fine? Is this normal for it? If it is, at what point should I be concerned that it's too much data for Sphinx?
Thanks for any thoughts.
I'm trying to limit the number of objects in an array controller, but I still want to be able to access the full array, if necessary. A simple solution I came up with was to subclass NSArrayController, and define a new method named "limitedArrangedObjects", that returns a limited number of objects from the real set of arranged objects. (I've seen http://stackoverflow.com/questions/694493/limiting-the-number-of-objects-in-nsarraycontroller , but that doesn't address my problem.)
I want this property to be observable via bindings, so I set a dependency to arrangedObjects on it.
Problem is, when arrangedObjects is updated, limitedArrangedObjects seems not to be observing the value change in arrangedObjects. I've hooked up an NSCollectionView to limitedArrangedObjects, and zero objects are being displayed. (If I bind it to arrangedObjects instead, all the objects show up as expected.)
What's the problem?
Here's the relevant code:
@property (readonly) NSArray *limitedArrangedObjects;
- (NSArray *)limitedArrangedObjects;
{
NSArray *arrangedObjects = [super arrangedObjects];
NSUInteger upperLimit = 10000;
NSUInteger count = [arrangedObjects count];
if (count > upperLimit) count = upperLimit;
arrayToReturn = [arrangedObjects subarrayWithRange:NSMakeRange(0, count)];
return arrayToReturn;
}
+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key;
{
NSSet *keyPaths = [super keyPathsForValuesAffectingValueForKey:key];
if ([key isEqualToString:@"limitedArrangedObjects"]) {
NSSet *affectingKeys = [NSSet setWithObjects:@"arrangedObjects",nil];
keyPaths = [keyPaths setByAddingObjectsFromSet:affectingKeys];
}
return keyPaths;
}
#include <iostream>
using namespace std;
int main()
{
cout << "Do you need to encrypt or decrypt?" << endl;
string message;
getline(cin, message);
int letter2number;
for (int place = 1; place < sizeof(message); place++)
{
letter2number = static_cast<int>(message[place]);
cout << letter2number << endl;
}
}
Examples of problem: I type fifteen letters but only four integers are printed. I type seven letters but only four integers are printed.
The loop only occurs four times on my computer, not the number of characters in the string.
This is the only problem I am having with it, so if you see other errors, please don't tell me. (It is more fun that way.)
Thank you for your time.
Hi,
I have an issue with the stack limit in my webservice.
I was suggested to read this article by fellow members of this forum, but I do not have an idea how to run the EDITBIN.
I am using VS2008 on Windows 7 (IIS7)
Thanks!
I'm writing an application (A juggling pattern animator) in PLT Scheme that accepts Scheme expressions as values for some fields. I'm attempting to write a small text editor that will let me "explode" expressions into expressions that can still be eval'd but contain the data as literals for manual tweaking.
For example,
(4hss->sexp "747")
is a function call that generates a legitimate pattern. If I eval and print that, it becomes
(((7 3) - - -) (- - (4 2) -) (- (7 2) - -) (- - - (7 1)) ((4 0) - - -) (- - (7 0) -) (- (7 2) - -) (- - - (4 3)) ((7 3) - - -) (- - (7 0) -) (- (4 1) - -) (- - - (7 1)))
which can be "read" as a string, but will not "eval" the same as the function. For this statement, of course, what I need would be as simple as
(quote (((7 3...
but other examples are non-trivial. This one, for example, contains structs which print as vectors:
pair-of-jugglers
; -->
(#(struct:hand #(struct:position -0.35 2.0 1.0) #(struct:position -0.6 2.05 1.1) 1.832595714594046) #(struct:hand #(struct:position 0.35 2.0 1.0) #(struct:position 0.6 2.0500000000000003 1.1) 1.308996938995747) #(struct:hand #(struct:position 0.35 -2.0 1.0) #(struct:position 0.6 -2.05 1.1) -1.3089969389957472) #(struct:hand #(struct:position -0.35 -2.0 1.0) #(struct:position -0.6 -2.05 1.1) -1.8325957145940461))
I've thought of at least three possible solutions, none of which I like very much.
Solution A is to write a recursive eval-able output function myself for a reasonably large subset of the values that I might be using. There (probably...) won't be any circular references by the nature of the data structures used, so that wouldn't be such a long job. The output would end up looking like
`(((3 0) (... ; ex 1
`(,(make-hand (make-position ... ; ex 2
Or even worse if I could't figure out how to do it properly with quasiquoting.
Solution B would be to write out everything as
(read (open-input-string "(big-long-s-expression)"))
which, technically, solves the problem I'm bringing up but is... ugly.
Solution C might be a different approach of giving up eval and using only read for parsing input, or an uglier approach where the s-expression is used as directly data if eval fails, but those both seem unpleasant compared to using scheme values directly.
Undiscovered Solution D would be a PLT Scheme option, function or library I haven't located that would match Solution A.
Help me out before I start having bad recursion dreams again.
I have written a minimal wxWidgets application:
stdafx.h
#define wxNO_REGEX_LIB
#define wxNO_XML_LIB
#define wxNO_NET_LIB
#define wxNO_EXPAT_LIB
#define wxNO_JPEG_LIB
#define wxNO_PNG_LIB
#define wxNO_TIFF_LIB
#define wxNO_ZLIB_LIB
#define wxNO_ADV_LIB
#define wxNO_HTML_LIB
#define wxNO_GL_LIB
#define wxNO_QA_LIB
#define wxNO_XRC_LIB
#define wxNO_AUI_LIB
#define wxNO_PROPGRID_LIB
#define wxNO_RIBBON_LIB
#define wxNO_RICHTEXT_LIB
#define wxNO_MEDIA_LIB
#define wxNO_STC_LIB
#include <wx/wxprec.h>
Minimal.cpp
#include "stdafx.h"
#include <memory>
#include <wx/wx.h>
class Minimal : public wxApp
{
public:
virtual bool OnInit();
};
IMPLEMENT_APP(Minimal)
DECLARE_APP(Minimal)
class MinimalFrame : public wxFrame
{
DECLARE_EVENT_TABLE()
public:
MinimalFrame(const wxString& title);
void OnQuit(wxCommandEvent& e);
void OnAbout(wxCommandEvent& e);
};
BEGIN_EVENT_TABLE(MinimalFrame, wxFrame)
EVT_MENU(wxID_ABOUT, MinimalFrame::OnAbout)
EVT_MENU(wxID_EXIT, MinimalFrame::OnQuit)
END_EVENT_TABLE()
MinimalFrame::MinimalFrame(const wxString& title)
: wxFrame(0, wxID_ANY, title)
{
std::auto_ptr<wxMenu> fileMenu(new wxMenu);
fileMenu->Append(wxID_EXIT, L"E&xit\tAlt-X",
L"Terminate the Minimal Example.");
std::auto_ptr<wxMenu> helpMenu(new wxMenu);
helpMenu->Append(wxID_ABOUT, L"&About\tF1",
L"Show the about dialog box.");
std::auto_ptr<wxMenuBar> bar(new wxMenuBar);
bar->Append(fileMenu.get(), L"&File");
fileMenu.release();
bar->Append(helpMenu.get(), L"&Help");
helpMenu.release();
SetMenuBar(bar.get());
bar.release();
CreateStatusBar(2);
SetStatusText(L"Welcome to wxWidgets!");
}
void MinimalFrame::OnAbout(wxCommandEvent& e)
{
wxMessageBox(L"Some text about me!", L"About", wxOK, this);
}
void MinimalFrame::OnQuit(wxCommandEvent& e)
{
Close();
}
bool Minimal::OnInit()
{
std::auto_ptr<MinimalFrame> mainFrame(
new MinimalFrame(L"Minimal wxWidgets Application"));
mainFrame->Show();
mainFrame.release();
return true;
}
This minimal program weighs in at 2.4MB! (Executable compression drops this to half a MB or so but that's still HUGE!) (I must statically link because this application needs to be single-binary-xcopy-deployed, so both the C runtime and wxWidgets itself are set for static linking)
Any tips on cutting this down? (I'm using Microsoft Visual Studio 2010)
Hello All,
I have inherited some code that I need to maintain that can be less than stable at times. The previous people are no longer available to query as to why they ran the application in an environment with unlimited stack set, I am curious what the effects of this could be? The application seems to have some unpredictable memory bugs that we cannot find and running the application under valgrind is not an option because it slows the application down so much that we cannot actually run it. So any thoughts on what the effects of this might be are appreciated.
Thank you.
I am working on a system for reserving seats. A user inputs how many seats they wish to reserve and the database will return a set of suggested seats that are not previously reserved that matches the number of seats being reserved.
For instance if I had the table:
SeatID | Reserved
-----------------
1 | false
2 | true
3 | false
4 | false
5 | false
6 | true
7 | true
8 | false
9 | false
10 | true
And the user inputs that they wish to reserve 2 seats, I would expect the query to return that seats (3, 4), (4, 5), and (8, 9) are not reserved and match the given number of input seats. Seats are organized into sections and rows. Continuous seats must be in the same row.
How would I go about structuring this query to work in such a way that it finds all available continuous seats that match the given input?
this is my model:
class Position(models.Model):
map = models.ForeignKey(Map,primary_key=True)
#members=models.CharField(max_length=200)
LatLng = models.CharField(max_length=40000)
infowindow = models.CharField(max_length=40000)
but it can't run ..
thanks
def mailTo(subject,msg,folks)
begin
Net::SMTP.start('localhost', 25) do |smtp|
smtp.send_message "MIME-Version: 1.0\nContent-type: text/html\nSubject: #{subject}\n#{msg}\n#{DateTime.now}\n", '[email protected]', folks
end
rescue => e
puts "Emailing Sending Error - #{e}"
end
end
when the HTML is VERY large I get this exception
Emailing Sending Error - 552 5.6.0 Headers too large (32768 max)
how can i get a larger html above max to work with Net::SMTP in Ruby
OK.
Some New Query Here.
Suppose user taps on a button & video begins to play. Now when video plays, it always in full screen mode.
But what do i need is explained below.
Video should be played in a portrait mode.
(but normally video is played in landscape mode ).
How?
Thanks in advance for sharing your knowledge with SO...
How do i display directory sizes in a sorted manner in Unix while listing only innermost sub-directories? For example, I don't want to something like this -
100270480 /a/b/BP/b/bat/qc3
100270416 /a/b/BP/b/bat/qc3/logs
99020464 /a/b/BP/b/bat/qc3/logs/i
99005456 /a/b/BP/b/bat/qc5
99005408 /a/b/BP/b/bat/qc5/logs
97726832 /a/b/BP/b/bat/qc5/logs/i
I just want -
99020464 /a/b/BP/b/bat/qc3/logs/i
97726832 /a/b/BP/b/bat/qc5/logs/i
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
if(section != 0) {
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(10, 10, 100, 30)];
view.backgroundColor = [UIColor redColor];
return view;
[view release];
} else {
return tableView.tableHeaderView;
}
}
This is my implementation of viewForHeaderInSection but whatever frame I make it's always showing me the same red frame. Do you see any problem with my code?
Can't post the picture because of my rep but here is the link ;-)
http://img638.imageshack.us/img638/3350/bildschirmfoto20100315uq.png
I'm trying to write a program in assembly and make the resulting executable as small as possible. Some of what I'm doing requires windows API calls to functions such as WriteProcessMemory. I've had some success with calling these functions, but after compiling and linking, my program comes out in the range of 14-15 KB. (From a source of less than 1 KB) I was hoping for much, much less than that.
I'm very new to doing low level things like this so I don't really know what would need to be done to make the program smaller. I understand that the exe format itself takes up quite a bit of space. Can anything be done to minimize that?
I should mention that I'm using NASM and GCC but I can easily change if that would help.
ini_set('max_execution_time',0);
ini_set('memory_limit','1000M');
These are the first two lines at the very top of my script.
I was under the impression if I ran something via cron memory limits didn't apply, but I was wrong. Safe mode is off and when I test to see if these values are being set they are but I keep getting the good ol' "PHP Fatal: Memory exhausted" error.
Any ideas what I may be doing wrong? And whats the "more elegant way" of writing "infinite" for the "memory limit" value is it -1 or something?
I want to create a wizard for the logo badge below with 3 parameters. I can make the title dynamic but for image and gradient it's hardcoded because I can't see how to make them dynamic. Code follows after pictures:
custom-styles: stylize [
lab: label 60x20 right bold middle font-size 11
btn: button 64x20 font-size 11 edge [size: 1x1]
fld: field 200x20 font-size 11 middle edge [size: 1x1]
inf: info font-size 11 middle edge [size: 1x1]
ari: field wrap font-size 11 edge [size: 1x1] with [flags: [field tabbed]]
]
panel1: layout/size [
origin 0 space 2x2 across
styles custom-styles
h3 "Parameters" font-size 14 return
lab "Title" fld_title: fld "EXPERIMENT" return
lab "Logo" fld_logo: fld "http://www.rebol.com/graphics/reb-logo.gif" return
lab "Gradient" fld_gradient: fld "5 55 5 10 10 71.0.6 30.10.10 71.0.6"
] 278x170
panel2: layout/size [
;layout (window client area) size is 278x170 at the end of the spec block
at 0x0 ;put the banner on the top left corner
box 278x170 effect [ ; default box face size is 100x100
draw [
anti-alias on
line-width 2.5 ; number of pixels in width of the border
pen black ; color of the edge of the next draw element
fill-pen radial 100x50 5 55 5 10 10 71.0.6 30.10.10 71.0.6
; the draw element
box ; another box drawn as an effect
15 ; size of rounding in pixels
0x0 ; upper left corner
278x170 ; lower right corner
]
]
pad 30x-150
Text fld_title/text font [name: "Impact" size: 24 color: white]
image http://www.rebol.com/graphics/reb-logo.gif
] 278x170
main: layout [
vh2 "Logo Badge Wizard"
guide
pad 20
button "Parameters" [panels/pane: panel1 show panels ]
button "Rendering" [show panel2 panels/pane: panel2 show panels]
button "Quit" [Unview]
return
box 2x170 maroon
return
panels: box 278x170
]
panel1/offset: 0x0
panel2/offset: 0x0
panels/pane: panel1
view main