Posts

Showing posts from September, 2012

qt4 - How can I add the QtSql library in Qt creater? -

when compile codes has database connection, there's error like, qtsql: no such file or directory i suppose sql library must in qt, dont have idea why error occured ? enable database's libraries? can me please, thanks from qtsql documentation, in .pro file have add, qt += sql afaik there no separate library included sql modulue. it's enough if add above line .pro file. since not aware of adding libraries, from qmake documentation, libraries can added using libs keyword. an example same documentation itself.. unix:libs += -lmath -l/usr/local/lib win32:libs += c:\mylibs\math.lib hope helps.

php - How can I provide temporary links to web pages? -

i intend give users ability share link profile other people, link should not usual link. instead : it should not give out real landing page the user should able deactivate if wish is possible ? the page be publicuserprofile.php?userviewid=12345 behind scenes (in db or something), 12345 mapped user santaclaus. if santaclaus decides, no longer wants profile publicly available, delete mapping of 12345=santaclaus.

.net - How to test a WPF user interface? -

using win forms mvc / mvp architecture, use class wrap view test ui while using mocks model , controller/presenter. wrapper class make in ui observable property test runner through properties , events. would viable approach testing wpf app? there better way? there gotchas watch out for? as testing itself, you're best off using ui automation framework. or if want more fluent , wpf/winforms/win32/swt-independent way of using framework, download white codeplex (provided you're in position use open source code in environment). for gotchas; if you're trying unit test views, run in threading issues. instance, if you're running nunit default testrunner run in mta (multi-threaded appartment), while wpf needs run sta (single-threaded appartment). mike two has real easy getting-started on unit testing wpf, without considering threading issue. josh smith has thoughts on threading issue in this post , , points this article chris hedgate. chris uses modified ...

deployment - Version control of deliverables -

we need regularly synchronize many dozens of binary files (project executables , dlls) between many developers @ several different locations, every developer has date environment build , test at. due nature of project, updates must done , on-demand (overnight updates not sufficient). not pretty, stuck time. we settled on using regular version (source) control system: put binary files, get-latest before testing , check-in updated dll after testing. it works fine, version control client has lot of features don't make sense , people confused. are there tools better suited task? or may different approach? update: i need clarify it's not tightly integrated project - more extensible system heap of "plugins", including thrid-party ones. need make sure modules-plugins works nicely recent versions of each other , core. centralised build suggested considered initially, it's not option. i'd take @ rsync. just create .cmd file contains call rsync...

csv - Using Apex Data Loader to load records into object with master details relationship -

i need load data 2 objects. able load data 1 object using data loader. second object has master-details relationship first object need have unique record id of records of first object in csv file. how can add record id's csv file? you download "master" records after initial upload , perform mapping similar (name -> id). in excel achieved vlookup. once have generated new list of "detail" objects, there should no problem uploading them. mapping "id->uploaded records" available in success log file created apex data loader. but better way loudly "screw salesforce id, don't need no stinking id" :) think if "master" has unique field. can "id" existing system import salesforce. create field in salesforce (if didn't already) , mark "external id". afterwards able use external id instead of normal salesforce id way make link between source , target. in pseudocode: with normal salesforce id m...

How to use GREP in FTP client where Destination Machine is Unix based -

how use grep in ftp client destination machine unix based? want find files containing specific string amoung files can not initiate telnet session. can initiate ftp session , needed find files/string in various folders & subfolders. kindly help. grep not part of standard ftp commands. i'm afraid you'll have make ls. far know doesn't support searching through subfolders though. see this thread client.

Is this a php variable variable bug? -

is there logical explanation this? <?php $$a = 'hello world'; echo $$a; //displays hello world echo $$aa; //displays hello world echo $$aaa; //displays hello world ?> if try $$a = 'hello world'; echo $$a; //displays hello world echo $$aa; //displays hello world echo $$aaa; //displays hello world die( "<pre>" . print_r( get_defined_vars(), true ) . "</pre>" ); you can see has registed variable no name yes, according php's naming conventions, bug

image manipulation - Is there a way to use GflAx to incorporate gradient colours? -

ok, narrow question of day. i'm using gflax (from xnview ) create graphic tiles. put gradients in though. is there way can within product? there sdk part of product can't find info there. you can not can create gradient in program , "loadbitmap" make mods need ontop of 'background' , save new file.

.net - Is a bool read/write atomic in C# -

is accessing bool field atomic in c#? in particular, need put lock around: class foo { private bool _bar; //... in function on thread (or many threads) _bar = true; //... same read if (_bar) { ... } } yes. reads , writes of following data types atomic: bool, char, byte, sbyte, short, ushort, uint, int, float, , reference types. as found in c# language spec . edit: it's worthwhile understanding volatile keyword.

egovernment - National holiday web service -

is there public/government web service can call find out national holidays given year? (for and/or country in world.) edit: have set of formulas calculate holidays? (c# language of choice if there choice.) there's web service @ http://www.holidaywebservice.com provide dates of holidays usa, republic of ireland, england , scotland. sell dll , source code. as details of algorithms, worse check out excellent calendrical calculations book (third edition), fascinating read matters calendrical, , includes sample lisp code calendar algorithms.

oop - C++ Quiz - Singletons -

i'll posting article on my blog , i'd verify haven't missed first. find example i've missed, , i'll cite on post. the topic failed singleton implementations: in cases can accidentally multiple instances of singleton? so far, i've come with: race condition on first call instance() incorporation multiple dlls or dll , executable template definition of singleton - separate classes any other ways i'm missing - perhaps inheritance? if use static instance field initialize in cpp file, can multiple instances (and worse behavior) if initialization of static/global tries instance of singleton. because order of static initialization across compilation units undefined.

java - Should I use System.out.println() or something else? -

i've been casually programming in java while, still have few burning questions on fundamentals. i've heard should use system.out.println() display data people, , others have given me different ideas (like printstream or else). what's best way print console in java? system.out is printstream. if main goal interact console, @ java.io.console . if main goal have kind of logging, use logging framework java logging api or log4j.

objective c - What's the modern equivalent of GetNextEvent in Cocoa? -

i'm porting archaic c++/carbon program obj-c , cocoa. current version uses asynchronous usb reads , getnextevent read data. when try compile in objective c, getnextevent isn't found because it's in carbon framework. searching apple support yields nothing of use. edit add: ok, i'm trying run document scanner through usb. have set usbdeviceinterface , usbinterfaceinterface (who came that name???) , call (*usbinterfaceinterface)->writepipeto() ask scanner scan. believe works. @ least flatbed light moves across page... then try use *(usbinterfaceinterface))->readpipeasyncto() read data. give function callback function, usbdoneproc() . the general structure is: startscan() waitforscan() startscan() calls writepipeto , readpipeasyncto waitforscan() has this: while (deviceactive) { eventrecord event; getnextevent(0,&event); if (gdataptr != savedataptr) { // more data timeout timeoutticks = tickcount() + 60 * 60; ...

search - Excel: Find value in column(s) -

i've got excel spreadsheet multiple columns of different lengths, each filled unsorted numbers. each column has header. is there way determine column(s) contain number? for instance, i'd love able =whichcols( 123, a, z ) , have excel tell me columns [b, c, , k] contain cells value of 123. though, ideally, i'm after comma separated list of headers. equally adequate find cells, in range (or ranges), have value; e.g. [b19, c32, , k908]. i feel i'm overlooking obvious built-in function. there might built-in way can write own function. put code in vba module : public function whichcols(searchvalue double, srcrange range) string dim rangecolumn range dim columncell range dim headerrow long headerrow = 1 ' headerinformation in rownr 1 ' whichcols = vbnullstring each rangecolumn in srcrange.columns each columncell in rangecolumn.cells if columncell = searchvalue if whichcols <...

c++ - Side effects of exit() without exiting? -

if application runs out of memory, re-run changed parameters. have malloc / new in various parts of application, sizes of not known in advance. see 2 options: track memory allocations , write restarting procedure deallocates before re-running changed parameters. (of course, free memory @ appropriate places if no errors occur) restarting application (e.g., winexec() on windows) , exiting i not thrilled either solution. did miss alternative maybe. thanks simplicity rules: restart app different parameters. it hard either track down allocs/deallocs , clean memory (just forget minor blocks inside bigger chunks [fragmentation] , still have problems rerun class), or introduce own heap-management (very clever people have invested years bring nedmalloc etc live, not fool illusion easy task). so: catch "out of memory" somehow (signals, or std::bad_alloc , or whatever) create new process of app: windows: createprocess() (you can exit() program after...

Is there a good admin generator for Ruby on Rails? -

my current project in rails. coming symfony (php) , django (python) background, both have excellent admin generators. seems missing in rails. for aren't familiar symfony or django, both allow specify metadata around models automatically (dynamically) generate admin interface common crud operations. can create entire intranet few commands or lines of code. have appearance , extensible enough 99% of admin needs. i've looked similar rails, of projects either have no activity or died long ago. there generate intranet/admin site rails app other scaffolding? scaffolding normal way create admin backend there project called activescaffold may solve problem.

oop - How do I access class variables of a parent object in PHP? -

an instance of class instantiates couple of other objects, example class b: $foo = new b(); i access a's public class variables methods within b. unless i'm missing something, way pass current object instances of b: $foo = new b($this); is best practice or there way this? that looks fine me, tend use rule of thumb of "would maintaining understand it?" , that's understood solution. if there's 1 "a", consider using registry pattern, see example http://www.phppatterns.com/docs/design/the_registry

Wordpress custom post type pagination -

i trying pagination working wp pagenavi plugin , custom post type (portfolio page) in wordpress , having no luck. here stripped down version of portfolio page: <?php get_header(); ?> <?php $type = 'portfolio'; $args=array( 'post_type' => $type, 'post_status' => 'publish', 'paged' => $paged, 'posts_per_page' => 1, 'caller_get_posts'=> 1 ); $temp = $wp_query; // assign original query temp variable later use $wp_query = null; $wp_query = new wp_query($args); ?> <?php if($wp_query->have_posts()) : while($wp_query->have_posts()) : $wp_query->the_post(); ?> ... <?php endwhile; else : ?> ... <?php endif; ?> <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } $wp_query = null; $wp_query = $temp; ?> <?php get_footer(); ?> i have permalinks set to: /%postname%/ and have re-saved them. when got pag...

multithreading - How does threading in powershell work? -

i want parallelize file-parsing actions network activity in powershell. quick google it, start-thread looked solution, but: the term 'start-thread' not recognized name of cmdlet, function, script file, or operable program. check spelling of name, or if path included, verify path correct , try again. the same thing happened when tried start-job. i tried fiddling around system.threading.thread [system.reflection.assembly]::loadwithpartialname("system.threading") #this next errors, arguments can't figure out documentation of .net $tstart = new-object system.threading.threadstart({dosomething}) $thread = new-object system.threading.thread($tstart) $thread.start() so, think best know wrong when use start-thread, because seems work other people. use v2.0 , don't need downward compatibility. powershell not have built-in command named start-thread. v2.0 does, however, have powershell jobs, can run in background, , can considered equival...

java - How to replace a character programmatically in Oracle 8.x series -

due repetitive errors 1 of our java applications: engine engine_0: error in application action. org.xml.sax.saxparseexception: invalid xml character (unicode: 0x13) found in element content of document. i need "fix" unicode character in oracle database, ideally in programmatic fashion. once identified, simple way "search , replace" it? assuming characters present in text field: update table set column=replace(convert(varchar(5000), column), 'searchstring', 'replacestring') (note work on text field no more 5000 characters, larger text fields increase number in query).

jQuery Interface Fisheye left align issue -

using groovy fisheye function jquery plugin interface, , setting "halign" "left" effect seems apply next image in list rather 1 mouse over. link remove margin-left: -50px; style rules a.dock-item2 in style.css . a.dock-item2 { display: block; font: bold 12px arial, helvetica, sans-serif; color: #000; bottom: 0px; position: absolute; text-align: left; text-decoration: none; margin-left: -50px; /* remove line */ }

iphone - Scale Entire UIView Proportionately -

i have base uiview takes entire iphone screen when horizontal. when device rotated portrait, want view scale down , in 2/3 size , center on screen shown: image: http://img25.imageshack.us/img25/3281/rotateqx.jpg i can't life of me figure out though. i've messed autoresizing, seems work if each subview, , though scale okay, because not elements centered don't end in right location in portrait mode. and far setting uiviewcontentmode, can work great individual elements, not view whole, , because i'm implementing customized drawing methods, can't set elements individually. placement issue comes effect again. thanks. have tried adjusting view's transform property? if use cgaffinetransformscale(), should effect want.

vba - MS Word: Creating shortcut or toolbar button for the "Paste Special..Unformatted Text" option -

i have been playing while, closest have gotten button opens paste special dialog box , requires couple of mouse clicks paste contents of clipboard unformatted text. so doing copy-paste web site document don't want additional baggage of html formatting, nice able shortcut key or toolbar button. make button call macro: public sub pastespecialunformatted() selection.pastespecial datatype:=wdpastetext end sub

sql - Hierarchy recordset in ms access -

how can hierarchy recordset in ms access through select statement? dao doesn't support hierarchical recordsets. may able use ado in access, i'm not certain.

asp.net - Which is better: to sort results at the database level or at the application level -

suppose have page in site displays records database. we need display records sorted column. which approach gives better performance: retreive data sorted database or apply sorting on grid ? thanks that depends on amount of data want display. few records can shown on 1 page , sure remain constant can sorted on ui side. for large data, sorting @ database better. if ui has pagination support, sorting @ database side avoid passing huge data ui , ui discarding rows except related first page.

Is it possible to get Code Coverage Analysis on an Interop Assembly? -

i've asked question on over msdn forums , haven't found resolution: http://forums.microsoft.com/msdn/showpost.aspx?postid=3686852&siteid=1 the basic problem here see interop assembly doesn't contain il can instrumented (except maybe few delegates). so, although can put test project exercises interop layer, can't sense how many of methods , properties i'm calling. plan b go , write code generator creates library of rcwws (runtime callable wrapper wrappers), , instrument purposes of code coverage. edit: @franci penov, yes that's want do. com components delivered constitute library of dozen dlls containing approx. 3000 types. consume library in our application , charged testing interop layer, since group delivering libraries minimal testing. code coverage allow ensure interfaces , coclasses exercised. that's i'm attempting do. have separate test projects exercise our own managed code. yes, ideally com server team should testing , analyz...

ruby on rails - Increase reliability of capistrano deploys -

i've used capistrano long time, sites weren't critical. if went wrong, few minutes of downtime weren't big problem. now i'm working on more critical service , need cover edge cases. 1 of if local connection server becomes interrupted in middle of deployment. one solution can think of deployments directly server, inside of screen session. seems reasonable , obvious solution, i'm surprised i've never read elsewhere or seen recommended in capistrano documentation. any pointers / tips welcome. thanks! there small time window during typical capistrano deploy dropped connection cause trouble. window when current release linked new version , server told restart. if connection drops before or after that, you're fine. if positively need safe disconnects 100%, can log onto server, open screen session , cap deploy latest release folder.

asynchronous - Silverlight listbox itemsource change not updating list -

working listbox in windows phone 7 trying make async web service call update listbox on success. the method calls webservice looks this: public void getreadinglist(action<observablecollection<ministoryviewmodel>> success, action<string> failure) i calling method code: api.getreadinglist( (items) => dispatcher.begininvoke(() => { lsbnewest.itemssource = items; }), (error) => { messagebox.show(error); }); using code nothing happens ui wise until click or scroll on listbox - contents updated correctly. assuming code not being run on correct thread, how can fix this? no errors in code, right regarding spec... try : flush itemssource, fill items addrange, or else. check if ui automatically updated. if not, create basic silverlight app on windows, , compare 2 behaviours... maybe bug ;=)

formapi - Disable Drupal's textarea expander? -

similar question posting form on so, drupal adds draggable expander bottom of textareas created through form api. how can disable in nice manner? the draggable expander gets added via behavior defined in 'misc/textearea.js'. can see applies textareas having class 'resizable'. can prevent output of class if set the '#resizable' property on textareas fapi definition false (it defaults true if not explicitly set). so own forms, can declare textareas accordingly. other forms, youd need adjust them via hook_form_alter() .

python - Object_list always empty -

the app working way. have simple news adding model below: class news(models.model): title = models.charfield(max_length=100) publication_date = models.datefield(auto_now_add=true) content = models.textfield() the view def homepage(request): posts= news.objects.all() #.get(title="aaa") return render_to_response('homepage.html', {'a':posts}) and tamplate: {% b in a.object_list %} <li> title:{{ b.title }}</li> {%empty %} empty {% endfor %} unfortunately sais 'empty'. if take '.get(title="aaa")' option instead of '.all()' (the commented part) got right title , content of message title 'aaa'. can explain doing wrong? in advance expertise. edit i'm sorry didn't have written template option off course 'get' verion of template differs. looks this: {{a.title}} {{a.content} and works printing expected title , message content 'get' works templa...

java - Multiple column sort in JTable -

i know jtable can sort single column. possible allow multiple column sort or need write code myself? you can sort multiple columns specifying more 1 sort key when calling setsortkeys in rowsorter you're using.

apache - CodeIgniter: How to disable "index.php" in URLs completely (disallow it if manually entered in URL) -

i'm using codeigniter , have been able use url's without "index.php" in there, if manually type in "index.php", urls still work. i'd disable access "index.php/controller" type urls in order avoid duplicate content penalty google. here current .htaccess file looks like: options +followsymlinks # turn on url rewriting rewriteengine on # installation directory rewritebase / # protect hidden files being viewed <files .*> order deny,allow deny </files> # protect application , system files being viewed rewriterule ^(?:application|modules|system)\b.* index.php/$0 [l] # allow files or directories exist displayed directly rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d # rewrite other urls index.php/url rewriterule .* index.php/$0 [pt] you can try replacing last 3 lines this rewritecond $1 !^(index\.php|robots\.txt) rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d re...

vb.net - application using graphics, only displays red X's over main window and control -

the code have interacts e.graphics is 'clear area e.graphics.fillrectangle(brushes.black, 0, 0, 600, 800) 'draw sand each in world e.graphics.fillrectangle(i.getcolor, i.getx, i.gety, 1, 1) next here variable areas of 2 classes, along new functions; assume lines think do. public class sand private x integer private y integer private type element public sub new(byval x integer, byval y integer, byval type element) me.x = x me.y = y me.type = type end sub public class element public color color public weight integer = 1 public spread double = 0.5 public text string = "null" public sub new(byval c color, byval w integer, byval s double, byval t string) color = c weight = w spread = s text = t end sub here spot in program dimensions world variable , such. private world list(of sand) private paused boolean = false private openbottom boolean = false private selected integer = ...

bison - How do i allow postfix characters on a literal? -

using bison/flex want make valid a = 9u i wrote rule allowing 'u' after literals realize flex isnt picking because letters return var instead of ascii value. how allow postfix character on literal? thinking write in lex rule dont know if nasty surprise happen. best place this? i'm assuming token number (what you're calling literal) named literal , , variable names following literals not normal construct (in algebraic languages case, unless want 9 foo mean 9 * foo ). you need write bison rule parse sequence literal var , return number (probably token besides literal unless want recursive rule, e.g. 9u u ). code rule should check var u (or legal postfix) , return error if finds unexpected. i've used sequences before parse units (e.g. g = 9.81 m/(s^2); ). if want demand u follow literal, , result literal token, you're going have change lex rule, assuming unquoted whitespace not passed on parser.

audio noise reduction -

i have 1 doubt regarding audio processing noise reduction. there free ware , share ware dlls available noise reduction in .wav audio files or sample codes using c#, vb.net or vb? sox cross-platform command-line application audio manipulation. quick check of man page reveals can noise reduction (see noiseprof , noisered ). you can use trim in combination noiseprof choose small clip of larger audio file use noise.

maven 2 - After updating a dependency to a new version (jfreechart from 1.0.12 to 1.0.13) I get "the type cannot be resolved..." errors -

i changed version jfreechart in pom.xml of maven project 1.0.12 1.0.13. error "the type org.jfree.ui.layer cannot resolved type. indirectly referenced required class files." what mean? updated jfreechart dependency. the type in jcommons library . think problem jfreechart has not been distributed maven in version 1.0.13. in ibiblio directory listing , can see .pom file missing (as opposed version 1.0.12 , it's present). this means maven has no ideas dependencies are. still downloads artifact through it's filename convention, doesn't know context. now can either complain vendor , demand proper pom or create own pom file (start the old version , adjust until things start working) , deploy company's repository (or local repository) using install:install-file or deploy:deploy-file . my guess you'll @ least have include following dependency <dependency> <groupid>jfree</groupid> <artifactid>jcommon</arti...

string - Easiest way to get file's contents in C -

what simplest way (least error-prone, least lines of code, want interpret it) open file in c , read contents string (char*, char[], whatever)? i tend load entire buffer raw memory chunk memory , parsing on own. way have best control on standard lib on multiple platforms. this stub use this. may want check error-codes fseek, ftell , fread. (omitted clarity). char * buffer = 0; long length; file * f = fopen (filename, "rb"); if (f) { fseek (f, 0, seek_end); length = ftell (f); fseek (f, 0, seek_set); buffer = malloc (length); if (buffer) { fread (buffer, 1, length, f); } fclose (f); } if (buffer) { // start process data / extract strings here... }

How to rename a Project Folder from within Visual Studio? -

my current solution renaming project folder is: remove project solution. rename folder outside visual studio. re-add project solution. is there better way? tfs users: if using source control requires warn before rename files/folders @ this answer instead covers steps required. to rename project's folder , file ( .*proj ) , display name in visual studio: close solution. rename folder(s) outside visual studio. (rename in tfs if using source control) open solution, ignoring warnings (answer "no" if asked load project source control). go through unavailable projects and... open properties window project (highlight project , press alt + enter or f4 , or right-click > properties). set property ' file path ' new location. if property not editable (as in vs2012), open .sln file directly in editor such notepad++ , update paths there instead. (you may need check-out solution first in tfs etc.) reload project - right-clic...

ASP.NET Page.User is null during AJAX request -

i'm using mvc2 framework , 1 of views has bit of conditional logic gets page.user.identity object , comparison other values determine display. that works fine on initial page load, when make ajax call partial page updates (i'm doing manually yui3, not .net ajax stuff) page.user object null. anyone know why page context seems discarding user object asynchronous requests? thanks, chris if request-handling method static webmethod , there won't page instance work , page null (that is, won't able resolve page.user ). if indeed problem, use httpcontext.current.user instead. (and sure read why asp.net ajax page methods have static? )

android - New contacts created using ContactsContract do not appear in Contacts app -

i'm using following piece of codes create new contact. follow closely contactmanager example provided android. problem is, created contacts not appear in contacts app shipped android. nevertheless, when load contacts phonebook, can see newly created contacts. private void insertpbentry() throws remoteexception, operationapplicationexception { arraylist<contentprovideroperation> ops = new arraylist<contentprovideroperation>(); ops.add(contentprovideroperation.newinsert(contactscontract.rawcontacts.content_uri) .withvalue(contactscontract.rawcontacts.account_type, "account type") .withvalue(contactscontract.rawcontacts.account_name, "account name") .build()); ops.add(contentprovideroperation.newinsert(contactscontract.data.content_uri) .withvaluebackreference(contactscontract.data.raw_contact_id, 0) .withvalue(contactscontract.data.mimetype, ...

c# - How I get the Values of a Lookup field in Silverlight with Client OM -

first of all, apology poor english. ok. i have in sharepoint 2010 list lookup field (list1), , other list (list2) values of lookup field of first list. in silverlight application, i'm working client object model. have combobox (lookup field of list1) want fill values of list2. when select item of combobox want save value in lookup field of list1. tried fieldlookup , fieldlookupvalue class don't have successful result. any idea this? this should work: ienumerablemystackpaneltobindonsearch = ienumerablemystackpanellist.where(stackpanel => (((fieldlookupvalue)stackpanel["stackpanellookup"]).lookupvalue.tolowerinvariant() == forpanel.title.tolowerinvariant()));

python - Create a .txt list of IPs in a subnet -

i'd make simple text (.txt) file. python program needs make list of multiple ranges of ips in subnet, each taking 1 line. example: 10.10.27.1 10.10.27.5 10.10.27.6 10.10.27.26 10.10.27.27 10.10.27.28 10.10.27.29 10.10.27.51 10.10.27.52 10.10.27.53 10.10.27.54 the subnet mask /24, providing mask input not necessary. program can default supporting standard class c. also, i'd support common ranges devices use. prompt say, "printers?" include .26 - .30. "servers?" include .5 - .7. "dhcp?" prompt include .51 - .100 of subnet. "abnormal?" include .100 - .254. subnet? 10.10.27.1 servers? y printers? y dhcp? y abnormal? n output being: 10.10.27.1 10.10.27.5 10.10.27.6 10.10.27.7 10.10.27.26 10.10.27.27 10.10.27.28 10.10.27.29 10.10.27.30 10.10.27.51 (all way .100) what best way code this? it looks few for loops need: network = '10.10.27' host in xrange(100, 255): print("{network}.{host}...

Using QtMobility/Location, a Symbian Qt C++ application runs in emulator but not on device -

i have symbian qt c++ mobile application runs fine in emulator when application compiled sis file , installed on phone, installs not start , fails silently without message. the application uses qtmobility 1.0.1 access location api. found issue i'm facing related following bug: https://bugreports.qt.io/browse/qtmobility-360 which caused using qt mobility 1.0.1 apis, linked against library (lbt) not available on symbian 5th edition devices (but available on symbian^3) when reverted using qt mobility 1.0.0 apis on device, application started successfully. the bug report states has been fixed in version 1.0.2 of qt mobility apis, hasn't been released yet.

c - Implementing GetBSDProcessList from sysctl.h -

could give me advice or snippet of code show me way of implementing method in listing . info processes on mac. i'm not c, familiar objective c. thanks! i found this answer on cocoabuilder start, use expanding.

iphone - Is NSUserDefaults the correct place to store a list of favorites? -

i programming app ios, allowing user make connections via tcp/ip. user able save server favorite. make possible serialising server object , storing nsuserdefaults. is correct way go or should rather save serialised object file system? thanks, mark. nsuserdefaults' data stored on filesystem. don't try re-invent wheel. it's here on purpose, , it's easy , convenient use. : )

php - MySQL error when using send() method of Email component in CakePHP -

i've followed tutorial here: http://book.cakephp.org/view/1286/sending-a-basic-message , have used before 1.2. however, in 1.3, different application, following error: warning (512): sql error: 1064: have error in sql syntax; check manual corresponds mysql server version right syntax use near 'send' @ line 1 [ core/cake/libs/model/datasources/dbo_source.php , line 673 ] query : send this sql error, try print out sql query tries execute , run separately in mysql workbench's query editor see how can fix it. you're missing small, escaping single quotes. doesn't seem related sending message

Convert HTML back to Markdown for editing in wmd -

i curious happens when edit post on site. i using wmd markdown editor, of course when goto edit, html generated not markdown on stackoverflow. now, there way can store both? or reliable enough convert html markdown show in wmd editor? thanks! look @ optionsexample.html in wmd distribution. there's option send result server markdown.

gcc - Imitate/emulate a big-endian behavior in C? -

i wondering if it's possible emulate big-endian behavior, testing purpose? via either windows or linux , mingw or gcc. here's sample of code emulation return big endian: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <limits.h> #if char_bit != 8 #error "unsupported char size detecting endianness" #endif int main (void) { short int word = 0x0001; char *byte = (char *) &word; if (byte[0]) printf("little endian"); else printf("big endian"); return 0; } you can't switch endianes testing purposes or that. can is, install emulator big-endian architecture , compile program emulator. here's 1 way, under: http://people.debian.org/~aurel32/qemu/ are debian disk images kinds of qemu supported architectures. mips, sparc , arm big-endian (do not download ending -el). i'm using debian lenny mips ( http://people.debian.org/~aurel32/qemu/mips/ ). install qemu platform, f...

c# - Reading forms authentication ticket w/firefox and chrome -

i have 3 application need single sign on. these web config sections using authentication, authorization , machine key settings. settings same in 3 web applications. works in internet explorer, doesn't work @ in firefox or chrome. there else need work firefox , chrome? <authentication mode="forms"> <forms loginurl="~/login.aspx" timeout="2880" name="ssocookie" path="/" requiressl="false" slidingexpiration="true" cookieless="usecookies" enablecrossappredirects="true"/> </authentication> <authorization> <deny users ="?"/> <!--allow users ="*"/--> </authorization> <machinekey validationkey="2c02f632abc3b809f0662b06eed7e985345504d93bb2893c3c8106f48a273054d4c29edd63f34cf3e19c76aa8fcf12c28ac127a9c5d6defc139800b302cadbdc" decryptionkey="d7367948dc5aa193408cadb000e580a0fccd71d8412d28e9ac76455fa85db766...

java - Makefile losing access to environment variables -

i've got makefile has couple of targets (all, install, uninstall). i'm trying use $java_home environment variable, works perfect in target, when install target executed, $java_home variable seems empty (although not - have checked in terminal). have ideas? all: # works @echo ${java_home} ifeq ($(uname), linux) install: # prints blank line. @echo ${java_home} # doing stuff here uninstall: # doing stuff here endif thanks, chris i don't see problem have posted, way set java_home before calling make may contributing factor. using export create environment variable? if not, make process might not inheriting part of environment.

Is using flexible array members in C bad practice? -

i read using flexible array members in c poor software engineering practice. however, statement not backed argument. accepted fact? ( flexible array members c feature introduced in c99 whereby 1 can declare last element array of unspecified size. example: ) struct header { size_t len; unsigned char data[]; }; the reason give not doing it's not worth tie code c99 use feature. the point can use following idiom: struct header { size_t len; unsigned char data[1]; }; that portable. can take 1 account when allocating memory n elements in array data : ptr = malloc(sizeof(struct header) + (n-1)); if have c99 requirement build code other reason or target specific compiler, see no harm.

user interface - Autocomplete vs Drop-down. When to use? -

i've read somewhere (can't remember/find where) article web usability describing when use drop downs , when use autocomplete fields. basically, article says human brain cannot store more last 5 options presented choose. for example, in profile form, there current occupation, , system gives bunch of options, when read sixth options, brain can't remember first 1 anymore. example great place use autocomplete field, user types thinks occupation , select better few options filtered. i hear opinion subject. when should use drop-down , when should use autocomplete field? for limited list, don't use autocomplete edit box or combobox, use listbox values visible @ once. limited lists, static content of 8 items, takes real estate, presents user better immediate overview. for less 5 items radiogroup or checkbox group (multiple selections) may better. for lists content dynamic, list of contacts, (scrolling) listbox or combobox appropriate because never know ...

hashchange - When using Ajax History and Bookmark, is it always good to use "#!" instead of just "#"? -

facebook doing ajax history (back , forward button) , bookmark using #! instead of # in url. idea that, because thinking usual anchor interfere ajax history mechanism trigger processing normal anchor. so, ajax history function process hash portion when sees #! instead of # . and using ! compatible major browsers? if facebook using ! , guess may supported. see google's making ajax applications crawlable possible use case (don't know if why facebook used fragment).

c - Are there fixed size integers in GCC? -

on msvc++ compiler, 1 can use __int8 , __int16 , __int32 , similar types integers specific sizes. extremely useful applications need work low-level data structures custom file formats, hardware control data structures , like. is there similar equivalent can use on gcc compiler? iso standard c, starting c99 standard, adds standard header <stdint.h> defines these: uint8_t - unsigned 8 bit int8_t - signed 8 bit uint16_t - unsigned 16 bit int16_t - signed 16 bit uint32_t - unsigned 32 bit int32_t - signed 32 bit uint64_t - unsigned 64 bit int64_t - signed 64 bit i use these types time. these types defined if implementation supports predefined types appropriate sizes , characteristics (which do). <stdint.h> defines types names of form (u)int_leastn_t (types have at least specified width) , (u)int_fastn_t (the "fastest" types have @ least specified width); these types mandatory. if you're using old implementation doesn't supp...

parsing - J2ME Properties -

j2me lacks java.util.properties class. although possible put application settings in jad file not recommended many properties. (since, platforms limits size of jad file.) want put configuration file inside jar file , parse it. , not want go xml because overshooting case. question is, there existing library j2me can parse properties files or similar such ini file. or recommend method solve initial problem? the best solution depends on going generating properties files. if you've got other non-javame projects using same properties files, stick them, , write or find parser. (there a simple 1 gobible available on google code ) however might find easy keep configuration static final string myproperty="myvalue"; in configuration.java file compile, , include in jar instead, since not need special code locate, open, read, , parse them. you pick limitation on call them though, since can no longer use common dot separated namespacing idiom.

How to close android browser after redirecting to my app? -

how can close browser once got redirected app. there way this? you should not start browser. can start own activity webview on it. when you're being redirected can handle event , close activity.

javascript - How good is jQuery's support for backwards compatibility? -

we have had issues mootools not being backward compatible in area of drag , drop functionality. wondering if has had similar problems jquery not being backward compatible. starting use quite heavily , thinking upgrading newer version start using several plugins require it. have issues if rid of older version? jquery seems nicely backward compatible. have been using more couple of years through several versions of core , have not had issues when upgrading except few minor ones plugins. core seems fine if you're using lot of plugins might run problems (but these easy fix, or new core has functionality built in anyway can drop them).

Connect Excel to Oracle -

can connect excel (excel-vba) oracle(in remote server) without installing oracle client in client system... tried options below throwing error oracle client should installed. below connectionstring have used 1)strconnection = "provider=oraoledb.oracle;data source=sourcename;user id=username; password=password;" 2)strconnection = "provider=msdaora;data source=sourcename;userid=username; password=password;" 3)strconnection = "provider=msdaora.1;user id=username/password;data source=sourcename;persist security info=false" 4)strconnection = "driver={microsoft odbc oracle};server=(description= (address=(protocol=tcp)(host=192.168.2.6)(port=1521) )(connect_data (service_name=servicename)));uid=username; pwd=password;uid=username;pwd=password;" 5)strconnection = "server=(description=(address=(protocol=tcp)(host=192.168.2.6) ...

c# - Referencing Namespace from Web.Config -

can declare namespaces in web.config don't have write using statements each namespace in each of codebehind files? <configuration> <system.web> <pages> <namespaces> <add namespace="mynamespace" /> </namespaces> </pages> </system.web> </configuration> is you're looking for?

Parent notification in MFC Dialog -

i have first dialog simple button on , while clicking button, second dialog created using cdialog::create(idd,this). parent notified when second dialog destroyed without adding code second dialog i.e., without adding m_pparent->notify() line in ondestroy method. have tried onparentnotify, pretranslatemessage, subclasswindow in parent dialog no success. have not used ws_child style second dialog. idea? to complete: in fact, have combobox derived class (but issue same buttons) , i'm displaying modeless dialog instead of displaying listbox. control generic possible modeless dialog used. that's why not want add specific notification in second dialog. if i'm obliged, use trick asked more generic solution. pretranslatemessage catches wm_paint, wm_ncmouseleave , wm_ncmousemove. use base class , have parent refer modeless child base class only. in base postncdestroy have post parent. it doesn't make sense have parent bunch of filtering / spying on messages. ...

asp.net - Why is aspnet_compiler.exe so slow (and can it be made any faster)? -

during our build process run aspnet_compiler.exe against our websites make sure late-bound stuff in asp.net/mvc builds (i know nothing asp.net assured necessary prevent finding failures @ runtime). our sites large in size, few hundred pages/views/controls/etc. time taken seems excessive in 10-15 minute range (for reference, longer takes entire solution approx 40 projects compile, , we're pre-compiling 2 website projects). i doubt hardware issue i'm running on latest quad core intel chip, 4gb ram , wd velociraptor 10,000rpm hard disk. , part of what's odd exe doesn't seem using cpu (1-5%) , doesn't seem doing awful lot of i/o either. so... known issue? why slow? , there way speed up? note: clarify couple of things people have answered about, not talking compilation of code within visual studio. we're using web application projects already, , speed of compilation of not issue. problem pre-compilation of site after these projects have been compiled (...

need server client connection code in android application -

i new android , need simple http connection codes client server(local server in network) communication in android application.the connection starts when application started , if there update in server should notified on client , server response must based on client request. please help. thanks socket socket; inputstream is; outputstream os; string hostname; int port; public void connect() throws ioexception { socket = new socket(hostname, port); = socket.getinputstream(); os = socket.getoutputstream(); } public void send(string data) throws ioexception { if(socket != null && socket.isconnected()) { os.write(data.getbytes()); os.flush(); } } public string read() throws ioexception { string rtn = null; int ret; byte buf[] = new byte[512]; while((ret = is.read(buf)) != -1) { rtn += new string(buf, 0, ret, "utf-8"); } return rtn; } public void disconnect() throws ioexception { try { is.close(); os.close(); s...

.net - How to cast a value of generic type T to double without boxing? -

imagine following simple code: public void f<t>(ilist<t> values) t : struct { foreach (t value in values) { double result; if (tryconverttodouble((object)value, out result)) { consumevalue(result); } } } public void consumevalue(double value) { } the problem above code casting object, results in boxing in loop. is there way achieve same functionality, i.e. feeding consumevalue values without resorting boxing in foreach loop? note, f must generic method. i can live expensive preparation code long executed outside loop once. instance, if fancy dynamic method needs emitted, fine if done once. edit t guaranteed of numeric type or bool. motivation. imagine meta data driven application, agent reports data stream, data item type dynamically emitted based on data stream meta data. imagine also, there normalizer engine, knows normalize numeric data streams according algorithm. type of incoming numeric data stream known @ run time , can ...

vim - How to paste over without overwriting register -

does know of way paste on visually selected area without having selection placed in default register? i know can solve problem pasting explicit register. it's pain in neck type " x p instead of p "{register}p won't work describe. replace selection content of register. have instead like: " haven't found how hide function (yet) function! restoreregister() let @" = s:restore_reg return '' endfunction function! s:repl() let s:restore_reg = @" return "p@=restoreregister()\<cr>" endfunction " nb: supports "rp replaces selection contents of @r vnoremap <silent> <expr> p <sid>repl() which should fine long don't use plugin has non-nore vmap p, , expects register overwritten. this code available script there . ingo karkat defined plugin solving same issue.

DB-side encryption via NHibernate -

we're looking encrypt field using db-side encryption via nhibernate (most examples we've come across app-side, not like). issue has been raised couple of times, no answers yet seems. on sql server 2005, instance, , forgetting key-related issues now, means inserting encryptbykey(key_guid(mykey), myvaluetoencrypt) , selecting decryptbykey(myencryptedfield). property might string, whereas field has varbinary. we've vaguely got somewhere - using upper() , lower() instead of encryption functions - combining paired properties, 1 mapped custom user type , other formula attribute. however if has ideas on how in nicer way, we'd grateful few pointers :o) posted outline of nasty hack on nhibernate forum

c# - Sample web Page using Mono and XSP on windows box -

i'm attempting first asp.net web page working on windows using mono , xsp web server. i'm following chaps example . first part of example works latest version of mono. web part seems fall on following error '{path name}\index.aspx.cs' not valid virtual path. here's full stack trace: system.web.httpexception: 'c:\projects\mono\aspexample\simpleapp\index.aspx.cs' not valid virtual path. @ system.web.httprequest.mappath (system.string virtualpath, system.string basevirtualdir, boolean allowcrossappmapping) [0x00000] @ system.web.httprequest.mappath (system.string virtualpath) [0x00000] @ system.web.compilation.buildmanager.addtocache (system.string virtualpath, system.web.compilation.buildprovider bp) [0x00000] @ system.web.compilation.buildmanager.buildassembly (system.web.virtualpath virtualpath) [0x00000] @ system.web.compilation.buildmanager.getcompiledtype (system.string virtualpath) [0x00000] @ system...

javascript - what am I missing in this RegEx? -

i'm trying create javascript regex test for: a valid # between 0 , 99.9 (where single decimal digit allowed) e.g. 3.45 not valid. so, blank ok, integer between 0 , 99 ok, , decimal value allowed. i have far, allowing values 3.45 pass: $^|$[0-9][0-9]?^|$[0-9][0-9]?.[0-9]^ two problems can see: you mixed ^ , $. your decimal point needs escaping \. .

In terms of databases, is "Normalize for correctness, denormalize for performance" a right mantra? -

normalization leads many essential , desirable characteristics, including aesthetic pleasure. besides theoretically "correct". in context, denormalization applied compromise, correction achieve performance. there reason other performance database denormalized? the 2 common reasons denormalize are: performance ignorance the former should verified profiling, while latter should corrected rolled-up newspaper ;-) i better mantra "normalize correctness, denormalize speed - , when necessary"

Python help - Parsing Packet Logs -

i'm writing simple program that's going parse logfile of packet dump wireshark more readable form. i'm doing python. currently i'm stuck on part: for in range(len(linelist)): if '### server' in linelist[i]: #do server parsing stuff packet = linelist[i:find("\n\n", i, len(linelist))] linelist list created using readlines() method, every line in file element in list. i'm iterating through occurances of "### server", grabbing lines after until next empty line(which signifies end of packet). must doing wrong, because not find() not working, have feeling there's better way grab between ### server , next occurance of blank line. any ideas? looking @ the file.readlines() doc: file.readlines([sizehint]) read until eof using readline() , return list containing lines read. if optional sizehint argument present, instead of reading eof, whole lines totalling approximately sizehint bytes (possibly after ro...

preg replace callback - what does this preg_replace_callback do in PHP? and how do I stop it leaking memory? -

i've got section of code on b2evo php site following: $content = preg_replace_callback( '/[\x80-\xff]/', create_function( '$j', 'return "&#".ord($j[0]).";";' ), $content); what section of code do? guess strips out ascii characters between 128 , 256, can't sure. also, stands, every time bit of code called within page, php allocates , not free upto 2k of memory. if function called 1000+ times on page (this can happen), page uses 2mb of memory. this causing problems web application. why losing memory, , how rewrite don't memory leak? not stripping, replaces high-ascii characters entities. see preg_replace_callback . create_function used make anonymous function, can use plain function instead: $content = 'Çà ! nœm dé fîçhïèr tôrdù, @ pöür têstër... ? ~ Œ[€]'; $content = preg_replace_callback('/[\x80-\xff]/', 'cb_chartoentity', $content); echo $econtent . '<br>...

visual studio - How to detect running program and ask to close it from VS Msi project? -

i have simple visual studio msi project. i want halt installation if detect running program of type (e.g. "aaa.exe") , wait until user closes before proceeding. how do that? generally speaking, have considered restart manager ? applications use windows installer 4.0 installation , servicing on windows vista automatically use restart manager reduce system restarts. default behavior on windows vista shut down applications rather shut down , restart operating system whenever possible. in cases system restart unavoidable, installers can use restart manager api schedule restarts in such way minimizes disruption of user's work flow. restart manager should automatically detect open files/handles-to-files are going updated .msi , gracefully stop/restart them.