Daily Archives

Articles indexed Friday June 11 2010

Page 7/114 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Any utility to test expand C/C++ #define macros?

    - by Randy
    It seems I often spend way too much time trying to get a #define macro to do exactly what i want. I'll post my current delemia below and any help is appreciated. But really the bigger question is whether there is any utility someone could reccomend, to quickly display what a macro is actually doing? It seems like even the slow trial and error process would go much faster if I could see what is wrong. Currently, I'm dynamically loading a long list of functions from a DLL I made. The way I've set things up, the function pointers have the same nanes as the exported functions, and the typedef(s) used to prototyp them have the same names, but with a prepended underscor. So I want to use a define to simplfy assignments of a long long list of function pointers. For example, In the code statement below, 'hexdump' is the name of a typdef'd function point, and is also the name of the function, while _hexdump is the name of the typedef. If GetProcAddress() fails, a failure counter in incremented. if (!(hexdump = (_hexdump)GetProcAddress(h, "hexdump"))) --iFail; So lets say I'd like to rplace each line like the above with a macro, like this... GETADDR_FOR(hexdump ) Well this is the best I've come up with so far. It doesn't work (my // comment is just to prevent text formatting in the message)... // #define GETADDR_FOR(a) if (!(a = (#_#a)GetProcAddress(h, "/""#a"/""))) --iFail; And again, while I'd APPRECIATE an insight into what silly mistake I've made, it would make my day to have a utility that would show me the error of my ways, by simply plugging in my macro

    Read the article

  • Is it necessary to look, website same in all browser?

    - by metal-gear-solid
    Is it necessary to look, website same in all browser? are some client mad? isn't it need of pixel perfection ( to inch to inch match with Design) a madness? isn't it asking IE6 Pixel perfection, as of now, is a madness? Is it sin to to use JavaScript for visual enhancement, like to enable border radius in IE using Javascript and from CSS in other browsers?

    Read the article

  • google oauth doesn't redirect to callback after authorization

    - by dstywho
    I can't seem to get google to redirect to the callback url after obtaining the auth token. By redirecting the user to the following url, the user can click grant or deny access. After that the user clicks on one of the choices, the user is not redirected back to the callback url. https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token=4%2F5ETLZ84rGmRxE_yx0b-_IFDReUxe&oauth_callback=http://blahblahblah.com/user_sessions/create&oauth_version=1.0&hd=default I'm wondering if anyone knows what the problem might be. Also does google require I use something like openssl.

    Read the article

  • rails: "unknown action" message when action is clearly specified

    - by john
    hi, I had hard time to figure out why I've been getting "unknown action" error message when I was do some editing: Unknown action No action responded to 11. Actions: bin, create, destroy, edit, index, new, observe_new, show, tag, update, and vote you can see that Rails did mention each action in the above list - update. And in my form, I did specify action = "update". I wonder if some friends could kindly help me with the missing links... here is the code: edit.rhtml <h1>Editing tip</h1> <% form_tag :action => 'update', :id => @tip do %> <%= render :partial => 'form' %> <p> <%= submit_tag_or_cancel 'Save Changes' %> </p> <% end %> _form.rhtml <%= error_messages_for :tip %> <p><label>Title<br/> <%= text_field :tip, :title %></label></p> <p><label>Categories<br/> <%= select_tag('categories[]', options_for_select(Category.find(:all).collect {|c| [c.name, c.id] }, @tip.category_ids), :multiple => true ) %></label></p> <p><label>Abstract:<br/> <%= text_field_with_auto_complete :tip, :abstract %></label></p> <p><label>Name: <br/> <%= text_field :tip, :name %></label></p> <p><label>Link: <br/> <%= text_field :tip, :link %></label></p> <p><label>Content<br/> <%= text_area :tip, :content, :rows => 5 %></label></p> <p><label>Tags <span>(space separated)</span><br/> <%= text_field_tag 'tags', @tip.tag_list, :size => 40 %></label></p> class TipsController < ApplicationController before_filter :authenticate, :except => %w(index show) # GET /tips # GET /tips.xml def index @tips = Tip.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @tips } end end # GET /tips/1 # GET /tips/1.xml def show @tip = Tip.find_by_permalink(params[:permalink]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @tip } end end # GET /tips/new # GET /tips/new.xml def new @tip = session[:tip_draft] || current_user.tips.build end def create #tip = current_user.tips.build(params[:tip]) #tipMail=params[:email] #if tipMail # TipMailer.deliver_email_friend(params[:email], params[:name], tip) # flash[:notice] = 'Your friend has been notified about this tip' #end @tip = current_user.tips.build(params[:tip]) @tip.categories << Category.find(params[:categories]) unless params[:categories].blank? @tip.tag_with(params[:tags]) if params[:tags] if @tip.save flash[:notice] = 'Tip was successfully created.' session[:tip_draft] = nil redirect_to :action => 'index' else render :action => 'new' end end def edit @tip = Tip.find(params[:id]) end def update @tip = Tip.find(params[:id]) respond_to do |format| if @tip.update_attributes(params[:tip]) flash[:notice] = 'Tip was successfully updated.' format.html { redirect_to(@tip) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @tip.errors, :status => :unprocessable_entity } end end end def destroy @tip = Tip.find(params[:id]) @tip.destroy respond_to do |format| format.html { redirect_to(tips_url) } format.xml { head :ok } end end def observe_new session[:tip_draft] = current_user.tips.build(params[:tip]) render :nothing => true end end

    Read the article

  • UITextField inside of UITableViewCell will not activate on iPad but works on iPhone

    - by cfihelp
    I have a UITextField inside a UITableViewCell. It will not activate on the iPad (but it works fine on the iPhone) no matter what I try. Tapping on it and telling it to become the firstResponder both fail. The odd thing is that if I take the exact same code and move it to another view controller in my app it executes just fine. This makes it seem as if there is likely a problem in the parent UITableViewController but I can't find anything obvious. I'm hoping that someone out there has experienced a similar problem and can point me in the right direction. Below is the sample code that works fine when I move it to a new project or put it in a new view controller launched immediately by my app delegate: // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } if (indexPath.row == 0) { UITextField *nameText = [[UITextField alloc] initWithFrame:CGRectMake(5, 5, cell.contentView.frame.size.width, cell.contentView.frame.size.height)]; nameText.delegate = self; nameText.backgroundColor = [UIColor redColor]; [cell.contentView addSubview:nameText]; [nameText becomeFirstResponder]; [nameText release]; } // Configure the cell... return cell; } Help!

    Read the article

  • Facebook proxy email not arriving -- do I need permissions?

    - by Felix
    I'm building a website that allows user to connect using Facebook Connect. So far I'm able to log the user in and fetch data about them (name, email, pic, etc.). If I fetch the email (using Users.getInfo) I get a proxied email ([email protected]), which is absolutely great. Problem is, that email doesn't work. I've tried sending an email to it and I never received it. There are two reasons I see that could cause this: I don't have enough permissions. Ok, I can understand that, but if I don't have enough permissions then why are they returning an email at all? The email has to be somehow sent from the application itself (I've tried sending it from my Gmail account) -- but how would Facebook know that the email is coming from the application? So which is it? Or is it something else?

    Read the article

  • iPhone dev question: "No provisioned iPhone OS is connected" error, I don't know what else to try fo

    - by dsobol
    Howdy, I am trying to compile and install my first application onto my iPhone after setting up a profile and certificate. At this point I am getting the "No provisioned iPhone OS is connected" error when I Build & Go. I am using iPhone OS 3.1.3, and Xcode 3.2.2 on 10.6.3. • I have verified that my iPhone is connected to my development machine (it is seen on the computer by both iTunes and Xcode Organizer (in Organizer, it has the green dot next to it)). • I have rebooted the iPhone and restarted Xcode multiple times. • I have verified that the Bundle Identifier in my appname.plist is set to com.. (with the appropriate values between the angle brackets). I have looked the error message up on the web, and so far have not found a hint that has gotten me over the hump.... Thanks for any and all assistance! Regards, Steve O'Sullivan

    Read the article

  • Python bindings for a vala library

    - by celil
    I am trying to create python bindings to a vala library using the following IBM tutorial as a reference. My initial directory has the following two files: test.vala using GLib; namespace Test { public class Test : Object { public int sum(int x, int y) { return x + y; } } } test.override %% headers #include <Python.h> #include "pygobject.h" #include "test.h" %% modulename test %% import gobject.GObject as PyGObject_Type %% ignore-glob *_get_type %% and try to build the python module source test_wrap.c using the following code build.sh #/usr/bin/env bash valac test.vala -CH test.h python /usr/share/pygobject/2.0/codegen/h2def.py test.h > test.defs pygobject-codegen-2.0 -o test.override -p test test.defs > test_wrap.c However, the last command fails with an error $ ./build.sh Traceback (most recent call last): File "/usr/share/pygobject/2.0/codegen/codegen.py", line 1720, in <module> sys.exit(main(sys.argv)) File "/usr/share/pygobject/2.0/codegen/codegen.py", line 1672, in main o = override.Overrides(arg) File "/usr/share/pygobject/2.0/codegen/override.py", line 52, in __init__ self.handle_file(filename) File "/usr/share/pygobject/2.0/codegen/override.py", line 84, in handle_file self.__parse_override(buf, startline, filename) File "/usr/share/pygobject/2.0/codegen/override.py", line 96, in __parse_override command = words[0] IndexError: list index out of range Is this a bug in pygobject, or is something wrong with my setup? What is the best way to call code written in vala from python? EDIT: Removing the extra line fixed the current problem, but now as I proceed to build the python module, I am facing another problem. Adding the following C file to the existing two in the directory: test_module.c #include <Python.h> void test_register_classes (PyObject *d); extern PyMethodDef test_functions[]; DL_EXPORT(void) inittest(void) { PyObject *m, *d; init_pygobject(); m = Py_InitModule("test", test_functions); d = PyModule_GetDict(m); test_register_classes(d); if (PyErr_Occurred ()) { Py_FatalError ("can't initialise module test"); } } and building with the following script build.sh #/usr/bin/env bash valac test.vala -CH test.h python /usr/share/pygobject/2.0/codegen/h2def.py test.h > test.defs pygobject-codegen-2.0 -o test.override -p test test.defs > test_wrap.c CFLAGS="`pkg-config --cflags pygobject-2.0` -I/usr/include/python2.6/ -I." LDFLAGS="`pkg-config --libs pygobject-2.0`" gcc $CFLAGS -fPIC -c test.c gcc $CFLAGS -fPIC -c test_wrap.c gcc $CFLAGS -fPIC -c test_module.c gcc $LDFLAGS -shared test.o test_wrap.o test_module.o -o test.so python -c 'import test; exit()' results in an error: $ ./build.sh ***INFO*** The coverage of global functions is 100.00% (1/1) ***INFO*** The coverage of methods is 100.00% (1/1) ***INFO*** There are no declared virtual proxies. ***INFO*** There are no declared virtual accessors. ***INFO*** There are no declared interface proxies. Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: ./test.so: undefined symbol: init_pygobject Where is the init_pygobject symbol defined? What have I missed linking to?

    Read the article

  • secure from unauthorised access

    - by soclose
    Hi, Based on the user requirements, he wants to use our android application via pin code access like login whenever he starts to use this application. In Android or any mobile, most of the applications start again the last using layout. so which event should i call this login alertdialog to access each time users start to use it? Or let me know the better. Thank you.

    Read the article

  • Permutations of Varying Size

    - by waiwai933
    I'm trying to write a function in PHP that gets all permutations of all possible sizes. I think an example would be the best way to start off: $my_array = array(1,1,2,3); Possible permutations of varying size: 1 1 // * See Note 2 3 1,1 1,2 1,3 // And so forth, for all the sets of size 2 1,1,2 1,1,3 1,2,1 // And so forth, for all the sets of size 3 1,1,2,3 1,1,3,2 // And so forth, for all the sets of size 4 Note: I don't care if there's a duplicate or not. For the purposes of this example, all future duplicates have been omitted. What I have so far in PHP: function getPermutations($my_array){ $permutation_length = 1; $keep_going = true; while($keep_going){ while($there_are_still_permutations_with_this_length){ // Generate the next permutation and return it into an array // Of course, the actual important part of the code is what I'm having trouble with. } $permutation_length++; if($permutation_length>count($my_array)){ $keep_going = false; } else{ $keep_going = true; } } return $return_array; } The closest thing I can think of is shuffling the array, picking the first n elements, seeing if it's already in the results array, and if it's not, add it in, and then stop when there are mathematically no more possible permutations for that length. But it's ugly and resource-inefficient. Any pseudocode algorithms would be greatly appreciated. Also, for super-duper (worthless) bonus points, is there a way to get just 1 permutation with the function but make it so that it doesn't have to recalculate all previous permutations to get the next? For example, I pass it a parameter 3, which means it's already done 3 permutations, and it just generates number 4 without redoing the previous 3? (Passing it the parameter is not necessary, it could keep track in a global or static). The reason I ask this is because as the array grows, so does the number of possible combinations. Suffice it to say that one small data set with only a dozen elements grows quickly into the trillions of possible combinations and I don't want to task PHP with holding trillions of permutations in its memory at once.

    Read the article

  • FileZilla is saying there is an error in the W3.org link!

    - by Anonymous the Great
    I just got my free web hosting set up (trigoblocks.comuf.com), I connected via FileZilla FTP and uploaded my files. The error I get is "Parse error: syntax error, unexpected T_STRING in /home/a3639879/public_html/header.php on line 1". Header.php line 1-2: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> I do not get this error while on localhost with XAMPP.

    Read the article

  • Why can't perfmon see instances of my custom performance counter?

    - by spoulson
    I'm creating some custom performance counters for an application. I wrote a simple C# tool to create the categories and counters. For example, the code snippet below is basically what I'm running. Then, I run a separate app that endlessly refreshes the raw value of the counter. While that runs, the counter and dummy instance are seen locally in perfmon. The problem I'm having is that the monitoring system we use can't see the instances in the multi-instance counter I've created when viewing remotely from another server. When using perfmon to browse the counters, I can see the category and counters, but the instances box is grayed out and I can't even select "All instances", nor can I click "Add". Using other access methods, like [typeperf][1] exhibit similar issues. I'm not sure if this is a server or code issue. This is only reproducible in the production environment where I need it. On my desktop and development servers, it works great. I'm a local admin on all servers. CounterCreationDataCollection collection = new CounterCreationDataCollection(); var category_name = "My Application"; var counter_name = "My counter name"; CounterCreationData ccd = new CounterCreationData(); ccd.CounterType = PerformanceCounterType.RateOfCountsPerSecond64; ccd.CounterName = counter_name; ccd.CounterHelp = counter_name; collection.Add(ccd); PerformanceCounterCategory.Create(category_name, category_name, PerformanceCounterCategoryType.MultiInstance, collection); Then, in a separate app, I run this to generate dummy instance data: var pc = new PerformanceCounter(category_name, counter_name, instance_name, false); while (true) { pc.RawValue = 0; Thread.Sleep(1000); }

    Read the article

  • Custom QAbstractGraphicsShapeItem very slow in Qt Jambi

    - by Mene
    I try to implement an own QAbstractGraphicsShapeItem in Qt Jambi (4.5) but as soon as I implement a custom class (rather than use e.g. QGraphicsEllipseItem) the rendering speed drops by about on order of magnitude. If looked in the original Code of QGraphicsEllipseItem and it seems to do basicly the same. class Circle extends QAbstractGraphicsShapeItem { final private QRectF rect = new QRectF(); public final void setRect(double x, double y, double w, double h) { QRectF newRect = new QRectF(x, y, w, h); if (!newRect.equals(rect)) { prepareGeometryChange(); this.rect.setX(x); this.rect.setY(y); this.rect.setWidth(w); this.rect.setHeight(h); this.update(rect); } } @Override public final QRectF boundingRect() { return rect; } QPainterPath shape; @Override public final QPainterPath shape() { if (shape == null) { QPainterPath path = new QPainterPath(); path.addEllipse(rect); QPainterPathStroker stroker = new QPainterPathStroker(); QPen pen = this.pen(); stroker.setCapStyle(pen.capStyle()); stroker.setWidth(pen.widthF()); shape = stroker.createStroke(path); } return shape; } @Override public final void paint(QPainter painter, QStyleOptionGraphicsItem option, QWidget widget) { painter.setPen(this.pen()); painter.setBrush(this.brush()); painter.drawEllipse(this.rect); } } I need to render a lot of objects and they are mostly moving, so speed is essential. Anyone knows how to speed this up? I underestand that Java might be slower then the nativ code in the library. But the code in the paint method seems not to be the problem, since commenting it out doesn't change the speed notably.

    Read the article

  • Rewriting subdomain to subfolder with htaccess

    - by Owen Allen
    I'm attempting to use .htaccess in the root folder of an Ubuntu/Apache2 server in order to mask a subdomain to subfolder and I keep getting a 500 Internal Error. I know that I'm doing something stupidly wrong and it is some silly error causing the problem. I've checked all of the similar threads on SO and online and whenever I try their advice the 500 continues. Here's my code. RewriteEngine on RewriteCond %{HTTP_HOST} ^admin\.mydomain\.com.*$ RewriteRule (.*) intranet/$1 [L] What I want to occur is that if a user visits admin.mydomain.com they will get the contents of the folder admin.mydomain.com/intranet/ but their URL bar will still be admin.mydomain.com. Any idea what I'm doing wrong? In addition, some of the threads online talked about possible problems with this system. Is this the best way of doing this masking, should I be using a vhost setup?

    Read the article

  • Need help Decoding JSON with XML

    - by brant
    I have a set of data that looks like this when using print_r($var): cbfunc({"query":{"count":"12","created":"2010-06-11T01:20:19Z","lang":"en-US"},"results":["\n 238.l.739089.t.4<\/team_key>\n 4<\/team_id>\n CHEE-HOO!!!<\/name> It looks like JSON to me, so I've tried to use json_decode but can't get it right. My goal is to print the xml data found in "results". Any helpful pointers would be greatly appreciated.

    Read the article

  • SQL SERVER – Difference Between DATETIME and DATETIME2

    - by pinaldave
    Yesterday I have written a very quick blog post on SQL SERVER – Difference Between GETDATE and SYSDATETIME and I got tremendous response for the same. I suggest you read that blog post before continuing this blog post today. I had asked people to honestly take part and share their view about above two system function. There are few emails as well few comments on the blog post asking question how did I come to know the difference between the same. The answer is real world issues. I was called in for performance tuning consultancy where I was asked very strange question by one developer. Here is the situation he was facing. System had a single table with two different column of datetime. One column was datelastmodified and second column was datefirstmodified. One of the column was DATETIME and another was DATETIME2. Developer was populating them with SYSDATETIME respectively. He was always thinking that the value inserted in the table will be the same. This table was only accessed by INSERT statement and there was no updates done over it in application.One fine day he ran distinct on both of this column and was in for surprise. He always thought that both of the table will have same data, but in fact they had very different data. He presented this scenario to me. I said this can not be possible but when looked at the resultset, I had to agree with him. Here is the simple script generated to demonstrate the problem he was facing. This is just a sample of original table. DECLARE @Intveral INT SET @Intveral = 10000 CREATE TABLE #TimeTable (FirstDate DATETIME, LastDate DATETIME2) WHILE (@Intveral > 0) BEGIN INSERT #TimeTable (FirstDate, LastDate) VALUES (SYSDATETIME(), SYSDATETIME()) SET @Intveral = @Intveral - 1 END GO SELECT COUNT(DISTINCT FirstDate) D_GETDATE, COUNT(DISTINCT LastDate) D_SYSGETDATE FROM #TimeTable GO SELECT DISTINCT a.FirstDate, b.LastDate FROM #TimeTable a INNER JOIN #TimeTable b ON a.FirstDate = b.LastDate GO SELECT * FROM #TimeTable GO DROP TABLE #TimeTable GO Let us see the resultset. You can clearly see from result that SYSDATETIME() does not populate the same value in the both of the field. In fact the value is either rounded down or rounded up in the field which is DATETIME. Event though we are populating the same value, the values are totally different in both the column resulting the SELF JOIN fail and display different DISTINCT values. The best policy is if you are using DATETIME use GETDATE() and if you are suing DATETIME2 use SYSDATETIME() to populate them with current date and time to accurately address the precision. As DATETIME2 is introduced in SQL Server 2008, above script will only work with SQL SErver 2008 and later versions. I hope I have answered few questions asked yesterday. Reference: Pinal Dave (http://www.SQLAuthority.com) Filed under: Pinal Dave, SQL, SQL Authority, SQL DateTime, SQL Optimization, SQL Performance, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • Arrays & Pointers

    - by Thomas
    Hi, Looking for some help with arrays and pointers and explanation of what I am trying to do. I want to create a new array on the heap of type Foo* so that I may later assign objects that have been created else where to this array. I am having troubles understanding what I am creating exactly when I do something like the following. Foo *(*f) = new Foo*[10]; Also once I have created my array how do I access each element for example. (f + 9)->fooMember(); ?????? Thanks in advance.

    Read the article

  • Reset ID autoincrement ? phpmyadmin

    - by Marcelo
    Hi, I was testing some data in my tables of my database, to see if there was any error, now I cleaned all the testing data, but my id (auto increment) does not start from 1 anymore, can (how do) I reset it ? Sorry for any mistake in English, and thanks for the attention.

    Read the article

  • generating images with php based on css3 gradient settings?

    - by thrice801
    Hi, Does anyone know if there is a php library, or if there isnt, have any input on how one would go about generating an image via php, from basic HTML element input settings, and CSS 3 gradient parameters. To give an example on why this would be useful, I have found as of a couple days ago, that laying out the wireframe for a webpage using basic Css3 gradient styling speeds up my design and development time by, well, alot. I cant design from photoshop, Ill spend hours tweaking stupid little things that only lead to me tweaking more stupid little things to compensate for stupid little changes. -- So, I had an epiphany to stop using photoshop until the end, and just focus on the main styling of elements, text-shadow, and borders for highlights, and I feel I am able to make super clean, more focused layout by being more restricted to the basics of graphic design with just css. Anyways, so Im planning on after I have the layouts done, to then recreate the graphics in photoshop, so that every browser is able to render the images. This wont take long, but as far as repeating it goes, if I could just do it with PHP, that would be incredible. For instance, take this style for example, which renders a clean looking ipad/pod ish menu/button gradient. [code] background: -moz-linear-gradient(top, #808080, #454545 50%, #313131 51%, #333333); background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #808080), color-stop(.5, #454545), color-stop(.5, #313131), to(#333333));[/code] Basically what Im looking to do is take one or more inputs that control rendering the image as you see there. Take a width and a height input, and then render the image gradient accordingly, so I can save it, upload it and then use it in my designs. So ya, I know PHP has some image generation capabilities but I dont know to what extent, any input on the most effective way to go about doing this or whether it already exists, would be appreciated!

    Read the article

  • TFS 2008 to TFS 2010 upgrade to exclude sharepoint

    - by Chen
    Hi, I'm currently planning to upgrade our TFS 2008 server to TFS 2010 with the condition below: 1. upgrade everything except for the sharepoint 2. upgrade everything including sharepoint but sharepoint will be enabled only at later stage. will this stop us from using TFS for our development? Thanks, Chen

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >