Posts

Showing posts from September, 2015

Paypal Website Payments Standard -

i'm having trouble finding out how set up. documentation horrendous @ best. called paypal , told them need: have own custom shopping cart client doesn't want pay monthly fee i told use website payments standard send cart contents , user can choose sign in/pay or pay cc without account. every link on documentation sends me silly html button creator. don't need hand-holding through coding, need know can find proper documentation. don't want paypal buttons send customers paypal cart page every time add something. https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_id=developer/e_howto_html_cart_upload this looking for. took 3+ hours find, congrats paypal. you've stolen money in past, you've stolen time. helps else looking same thing.

winapi - How to refresh Windows Explorer -

Image
a network volume's name can changed. changed name spinal disk to change network name, do write new name in registry. attach network volume using functions definedosdevicew. in timing, windows explorer read registry in guessing. shchangenotify(shcne_driveadd, shcnf_path, root, null); // sure. sendmessagetimeout(hwnd_broadcast, wm_devicechange, message, (lparam)(&dbv), - smto_abortifhung, 200, &dwresult); // sure again! it works, doesn't work though use shchangenotify , wm_devicechange sure. sometimes, new name not applied in windows explorer. if terminate explorer , re-execute, name applied. i'm finding interface having windows explorer refreshed.(is correct syntax? sorry, can't express sentence well.) there proper function? explorer should re-read registry , refreshed. unfortunately, explorer can't refresh every time told so. because way many apps behave badly, , use shchangenotify() shcne_allevents. imagine if exp

python - Sqlalchemy type for very long text for articles -

what type should define in sqlalchemy definition text article or blog entry? i'm using mysql. column('article_text', ???) column('article_text', sqlalchemy.unicodetext()) that should work on supported database, not mysql.

iphone - Custom behavior when "back" button in nav bar pressed -

i know can add custom "back" button uinavigationbar, doing removes existing button tapered left side, described in what happens when button pressed in navigationbar is there way keep existing behavior , of button, informed when pressed? basically, want app play sound whenever button touched. can uitabbarcontroller via delegate, delegate uinavgationbarcontroller has no such functionality. the following possibilities view controller disappear. clicking on button (other backbarbuttonitem ). clicking on backbarbuttonitem either case viewwilldisappear: method called. keep boolean flag . lets name isanybuttonclicked . , set isanybuttonclicked = yes whenever button clicked. , override viewwilldisappear: method, , play sound if no button clicked(ie., isanybuttonclicked == no ). viewwilldisappear: like, - (void)viewwilldisappear:(bool)animated { [super viewwilldisappear:animated]; if (!isanybuttonclicked) { // play sound isanybu

oop - How to provide specific GWT implementations -

suppose working on exposing of server-side classes gwt application, parts done better using gwt-specific components (like jsni, instance). what techniques doing without being hacky? for instance, aware of using subpackage , using <super-source/> tag, requires package names different, causes eclipse complain. general solution in community tell eclipse use source folder, eclipse complains there being 2 classes same name. ideally, there way keep in single source tree, , have different classes apply alternate implementations. feel more oo approach. i add suffix class _gwt accomplishes automatically, , know write script kind of transformation, kludge sure. i've been considering using google's gin/guice libraries projects in general, , think there might kind of solution there, not sure have not thoroughly investigated it. what solutions have tried in past on gwt projects? the easiest way have split implementations use super-source code, enough instan

delphi - TJvHidDeviceController "DevicePath" always showing "\" -

i'm using tjvhiddevicecontroller class retrive hid device information. have plugged 2 hid devices, i'm trying ge "devicepath" of sp_device_interface_detail_data_a structure getting device path '\'. ican't open createfile function. please me solve issue. os win7. all. this guessing! the 1 thing can think of is: tjvhiddevicecontroller calls windows api call without using or w suffix. structure used sp_device_interface_detail_data_a, ansi version. now, if use delphi 2009 or higher, routine expect sp_device_interface_detail_data_w. size same looks ok. strings stored usc2 encoded (widechars) instead of ansi encoded -> after every ansi character there null byte. tjvhiddevicecontroller converts character array pascal string using function strpas , hence, see first character. check: set breakpoint after function call fills structure , use cpu window view content memory dump. if see ansi characters every other byte , null bytes in between, ca

android - Uploading video on server through POST -

i know how can upload video file on server using post in android. please, let me know answer, if knows it? thanks take @ httpurlconnection . has sample code showing how post.

php - My website is taking a long time processing and opening pages. Why? -

i have developed web portal in joomla, images oriented, hence there lots of images on site. website taking long time processing , opening pages. reason, , how can resolve it? one major thing check optimizing images. link nick provided in previous answer yahoo best practices provide information. if working joomla out of box say, culprit images using. make sure you're images correct display size, not larger. don't use html size image height , width command this: <img src="someimage.jpg" height="400" width="600" > use photo editor make image actual size need.

asp.net - Hashing vs. Encrypting Passwords -

i'm using asp.net membership site serve sophisticated users. understand difference between hashed , encrypted passwords, , i'm trying decide between two. after last client complained bitterly hashed passwords being total pita, i've started favor encrypted passwords. suggested isn't secure enough. so question is: what, risks of encrypting passwords? person ability steal passwords decrypting them database surely have ability reset them if hashed, no? i'm having trouble seeing cause trouble encrypted passwords couldn't hashed ones. making convenient users important. the risk decryptable passwords people use 1 password various logins , accounts, not application dealing with. with encrypted password, stolen/decrypted password tried out on users' other accounts (e.g. stolen banking password lead access email). with hashed password, there no recovery. theft of password hashes should never yield usable passwords treat passwords property of ac

android - Call widget's onUpdate method from the app's main activity -

i'm working on android application includes widget. main interface of app simple activity, of things users can in activity make necessary update widget - i.e. run onupdate method. how can trigger method activity? looking @ other questions , i've been able write code changes layout, doesn't seem run onupdate (since i'm left empty layout , none of data added during onupdate). any ideas or code samples appreciated! i still pretty new android, accomplished 3 steps: first, put contents of appwidgetprovider.onupdate in method ( myupdate(context) ). second, overrode appwidgetprovider.onreceive() this: public void onreceive(final context context, final intent intent) { super.onreceive(context, intent); if (my_public_static_string.equals(intent.getaction())) { myupdate(context); } } third, other activity, send generic broadcast action set on intent. intent updatewidgetintent = new intent(context, mywidget.class); updatewidg

how to change the row background colour based upon some criteria in EXTJS -

dear sir/madam, i'm new extjs coding.i'm learning it.i've come across problem of changing row background colour based upon criteria in complete extjs coding.can me,please ? you have use getrowclass method in gridview set custom css class of row: viewconfig: { forcefit: true, showpreview: true, // custom property enablerowbody: true, // required create second, full-width row show expanded record data getrowclass: function(record, rowindex, rp, ds){ // rp = rowparams if(record.get('isred')){ return 'x-grid3-row-red'; } } }, where have defined css class x-grid3-row-red. look method getrowclass in documentation: http://dev.sencha.com/deploy/dev/docs/?class=ext.grid.gridview

opengl es - Cocos2D: increasing Sprite Brightness -

is there way adjust brightness of ccsprite without using overlay sprite or creating separate texture? color property doesn't work since can decrease brightness. i thinking possible overriding draw method , adding opengl calls similar found in http://developer.apple.com/library/ios/#samplecode/glimageprocessing/introduction/intro.html , of attempts have failed , novice @ writing raw opengl. know if possible , calls need made? although not same brightness, more bright. [sprite setblendfunc:(ccblendfunc){gl_src_alpha, gl_one}];

Tail Recursion vs Forward recursion in Erlang -

is tail recursion better forward recursion perfomance in erlang? or erlang compiler optimizes forward recursion too? mean, there reasons use tail recursion instead of forward recursion? in opinion, forward recursion looks more pretty. tail recursion better because uses less memory. bring need onto next call, minimizes memory utilization on stack. also, when tail recursive code optimized, function returns not needed thrown away make faster in cases. for example, if function's return value call function, there no need keep intermediary function on stack. code jumps directly caller inner function. non-tail recursion optimized tail recursion in cases erlang compiler, don't count on it. make habit code tail recursive functions whenever can.

Is using the "escape" tag really mandatory as a good security pattern in Django? -

in the security chapter of the django book , says must use template tag {% escape %} in order protect site cross-site scripting. is necessary put escape tag on every single template string? there way specify @ application level? that version of django book written before 1.0 came out, , out of date. template content has been autoescaped quite time now.

asp.net - Advantages of .NET 3.5 vs 2.0, for customers -

did ever have persuade customers migrating asp.net web forms application 2.0 3.5 necessary? why customers should install new framework? (and new operating system - there lot of windows 2000 machines out there although support ended in 2010 ). which advantages them? security? performances? costs? is reason 2.0 old ? any link appreciated. ps: please don't answer 3.5 has linq, it's advantage developers not customers the advantage here indirectly customer, (hopefully) allowing write code faster/shorter , therefore fewer bugs , more deadlines hit. there may small performance increases newer iterations of franmework.

visual studio 2010 - Debug single role instance with Azure Compute emulator -

i'm building application run on azure. visual studio solution contains multiple azure role projects. when debugging locally, use azure compute emulator. to start debugging, follow these steps: i right-click on azure project , click set start project. i press f5 start debugger. what happens emulator/vs2010 launches both web roles , worker roles, if i'm interested in debugging single worker role @ moment. when writing background-processing code in worker role, i'm interested step through code without starting web role, launch internet explorer , on well. is there convinient way make debugger launch 1 of role instances , not of them? i'm thinking of creating separate project in solution of type console application, load same assemblies in worker role , execute same code. the emulator (similar azure itself) works on concept of "cloud service". when launch w/ debug, going launch whatever defined in cloud service (.ccproj) project. mimics

c# - Single statement conditionals - why is the pattern not used for other code blocks? -

just thought i'd see if explain why anders decided valid... if(...) //single statement else ///single statement but not... try //single statement catch //single statement to quote framework design guidelines in section "general style conventions" said braces: avoid omitting braces, if language allows it. braces should not considered optional. single statement blocks, should use braces. increase code readability , maintainability. there limited cases when omitting braces might acceptable, such when adding new statement after existing singöe-line statement either impossible or extremely rare. example, meaningless add statement after throw statement: if(someexpression) throw new argumentoutofrangeexcetion(...); another exception rule braces in case statements. these braces can omitted case and break statements indicate begining , start of block. what anders thinks subjective , argumen

wsc - Is the RegExp object in VBScript Thread Safe when used inside a Windows Scripting Component -

i've trying track down issue legacy windows scripting component use. looking @ several memory dumps in windbg have found alot of threads, in fact looks 50% of apps threads waiting thread complete. thread has long stack below. thread doing work regexp object, question regexp thread safe? it looks isn't other threads waiting on want before jump conclusions , have struggled find real information online. vbscript!regexpexec::popgreedystar+3a vbscript!regexpexec::fexecaux+639 vbscript!regexpexec::fexec+1f vbscript!regexpexec::exec+5a0 vbscript!regexpexec::replaceusingstring+2d vbscript!cregexp::origreplace+14e vbscript!cregexp::replace+80 oleaut32!dispcallfunc+16a oleaut32!ctypeinfo2::invoke+234 vbscript!cregexp::invoke+24 vbscript!idispatchinvoke2+b2 vbscript!idispatchinvoke+59 vbscript!invokedispatch+13a vbscript!invokebyname+42 vbscript!cscriptruntime::runnoeh+22b2 vbscript!cscriptruntime::run+62 vbscript!csc

ruby on rails - devise: cannot login if I have a user controller with a show method -

i'm using devise on rails 3 project , i'm trying bdd using cucumber , rspec. the problem when go login using cucumber scenario so: scenario: login given not authenticated , on home page , have user username "jsmith" when follow "log in" , fill in "username" "jsmith" , fill in "password" "password" , press "sign in" should on home page , should see "logged in successfully." , should see "log out" i run problem when i've got following in routes.rb match 'home' => "home#index" devise_for :users, :path_names => { :sign_in => 'login', :sign_out => 'logout'} devise_scope :user '/login' => 'devise/sessions#create' '/logout' => 'devise/sessions#destroy' end resources :users the problem don't see "logged in successfully"

How should LINQ queries and Dao layer return queries to the view? -

when used use ado.net, used create tableadapters populated using joined queries, example product table adapter have column 'location' if underlying select query joined product location table. in linq, how accomplish this? return columns in joined query writing linq queries in productsdao class? type returning binding gridview? problem retuning linq results have thought break consistency of productsdao class (this should return product rows db). i think best option define classes represent joined data want return (e.g. productdetails ) , return iqueryable<productdetails> data layer. to return queryable, can write simple linq query: public iqueryable<productdetails> getproducts() { return p in db.products join d in db.details on p.id equals d.id select new productdetails { p.name, d.notes }; } this approach has several benefits: you're not exposing yourdatacontext object directly - can stay private field of dao class

magento - Change customer attribute position in backend -

i've added customer attributes appear correctly in backend. cannot change position. i've search in eav_attribute , customer_eav_attribute tables , haven't found position field strange because both @ attribute setup , in mage_customer_model_entity_setup, possible specify position in setup array. of course, while setting new customer attributes, correctly gave position key => value new attributes. does have clue on how change customer's attributes position in backend ? or sorting key unfortunately attribute_id ? thanks lot help! you can specify relation in table eav_entity_attribute.

user interface - Accessing a matrix in Matlab -

assume user input data below. define matrix cost. matrix created 3 3 matrix. matrix should form this: cost = [c11 c12 c13 c21 c22 c23 c31 c32 c33] since want display set of row, : c1 = cost(1,:); % become c1 = c11 c12 c13 c2 = cost(2,:); % become c2 = c21 c22 c23 c3 = cost(3,:); % become c3 = c31 c32 c33 then want value in matrix. this. c11 = cost(1,1); c12 = cost(1,2); c13 = cost(1,3); c21 = cost(2,1); c22 = cost(2,2); c23 = cost(2,3); c31 = cost(3,1); c32 = cost(3,2); c33 = cost(3,3); so equation want use type of matrix. lambda = ((8*c13*c23*c33*pdt)+(4*c12*c23*c33)+(4*c13*c22*c33)+(4*c13*c23*c32)) ./ (4*c23*c33)+(4*c13*c33)+(4*c13*c23)); so problem is, if want make 4 3 matrix, , generate matrix this: cost = [c11 c12 c13 c21 c22 c23 c31 c32 c33 c41 c42 c43] the equation want use matrix(4 3) quite different. how im gonna it? need use if else statement? or while? can me solve th

c++ - How to obtain a list of accesible named pipes on remote server? -

can somehow list named pipes on remote server client application? on local computer use hfindfile = findfirstfile("\\\\.\\pipe\\*",&fdfiledata); where hfindfile handle , fdfiledata win32_find_data struct. call findnextfile() repeatedly , when returns 0 close findclose(). works perfect on local machine, when try call hfindfile = findfirstfile("\\\\servername\\pipe\\*",&fdfiledata); it resulted error_invalid_function. advise me need connect remote server wnetuseconnection(), me it's not clear object have connect to. if other machine windows, sufficient map drive using wnetuseconnection() , gain credentials require connect other resources (i.e. named pipes). http://support.microsoft.com/kb/256847

Code to upload Video from Android to PHP -

i trying upload video android code php web server code can't success. referring following link perform uploading task getting following response in android code, can't found file on php server. android response debug/servercode(29484): 200 debug/serverresponsemessage(29484): ok i have checked many things setting values in php.ini files. although can upload images android code server becasue android sending 64 bit encoded bytearray , therer ready-made function in php can create image encoded bytearray s. but code not working in case of other file having type other image. please guide me if of have done similar before. php code using: <?php $target_path = "./upload/"; $target_path = $target_path . basename( $_files['uploadedfile']['name']); if(move_uploaded_file($_files['uploadedfile']['tmp_name'], $target_path)) { echo "the file ".basename( $_files['uploadedfile'][&#

php - Session handling with Recess! -

i using recess framework application & troubled session handling. need store values in session.. able create session , session id. navigate page, not able retrieve them !! how people manage sessions? php session handling simple , straight forward.. not able right! in home controller have: /* !route get, / */ function index() { . . session_start(); $_session['val'] = 'somevalue'; . . } my view displays form , when user submits, need access session val well.. try value as: /* !route get, /check */ function check() { if(isset($_session['val'])){ . . . } } but unfortunately, don't enter if block .. not able see mistake tried displaying session using session_id() , blank value in check() method. i noticed that, time create new session, session_id same!! in php? far read, should different! after many trails , discussion other community members @ recess framework's forum, here

ocr - How to make tesseract to recognize only numbers, when they are mixed with letters? -

want use tesseract recognize numbers. problem have mixture of numbers & letters , when use setvariable("tessedit_char_whitelist", "0123456789") every symbol tesseract returns wrong digit. can set threshold value tesseract omits symbols low resemblance? note: set tesseract recognize digits there no confusion between o , 0. recognizing numbers answered on tesseract faq page. see page more info, if have version 3 package, config files set up. specify on commandline: tesseract image.tif outputbase nobatch digits as threshold value, i'm not sure mean. if input unusual font, perhaps might retrain sample of input. alternative change tesseract's pruning threshold. both options mentioned in faq.

Jquery tooltips for joomla site -

i want replace java script alert messages , tool tips jquery tool-tips in joomla site. you write system plugin onafterrender(): searched output code regular expressions javascript alert messages injects jquery includes need jdocument replaces of alerts jquery version hth, jochen

jquery - Replace the current page with HTML from AJAX call -

please vote close question. using partial view , things work perfectly! i make successful post. understand result here: $(document).ready(function() { $('.pagination a').live('click', function() { $.post(this.href, $('form').first().serialize(), function(result) { }); return false; }); }); ...corresponds response body. can i, , know sounds stupid, replace current page html? i not sure if missing someting, should able place in callback: $(window).html(result);

mysql - error with PDO connection in php -

i have php version 5.2.8 on windows 2003 server, trying connect database $dbh = new pdo("mysql:host=localhost;port=3306;dbname=$db_name", $db_user, $db_pass); but when use statement got following error fatal error: uncaught exception 'pdoexception' message 'could not find driver' in bin\db.php:14 stack trace: #0 bin\db.php(14): pdo->__construct('mysql:host=loca...', 'root', '123') #1 main.php(4): include_once('c:\inetpub\wwwr...') #2 {main} thrown in bin\db.php on line 14 how can fix problem? thanks you must remove ; on line in php.ini : ;extension=php_pdo_mysql.dll extension=php_pdo_mysql.dll

javascript - numeric/string to only numeric -

in javascript, how transform "numeric/string" variable numeric? using function or regular expression.? sample: input: 11.489.301/0001-47 to: 11489301000147 use replace() remove non-numeric characters, , number() convert string type number type: var num = number("11.489.301/0001-47".replace(/\d/g, "")); alert(num); //-> 11489301000147

c# - How can I add a Basic Auth Header to my SOAP? -

i'm trying send authentication header through wsdl service not have authentication requirement specified on wsdl . how can add auth header call web service ? code have been working with: using system; using system.web.services.protocols; namespace testesoap { class mainclass { public static void main (string[] args) { wsdlservice service = new wsdlservice(); /* how can add authentication call of webservice ? */ service.get(); console.writeline ("hello world!"); } } } this problem questioned in other link in different way related wsdl including question user/password. link they aren't same question problem related. michaelis.mockservice webservice library extracted may see example on how in: link mono project website. michaelis.mockservice service = new michaelis.mockservice(); // create network credentials , assign // them service credentials

c++ - creating a map from two vectors -

if have 2 stl vectors vect1, vect2 , want produce them map, first element vect1 correspond first element in vect2 , on. how can in simple way? std::vector<int> a, b; // fill vectors here... std::map<int, int> m; assert(a.size() == b.size()); (size_t = 0; < a.size(); ++i) m[a[i]] = b[i];

java - OSGi loose-coupling best practice -

i'd know considered best practices or patterns decoupling application code framework code, regarding osgi. i'm going use example felix scr pages the example service comparator package sample.service; import java.util.comparator; public class samplecomparator implements comparator { public int compare( object o1, object o2 ) { return o1.equals( o2 ) ? 0 : -1; } } the code above contains no framework plumbing, it's focused , concise. making available application, when using osgi, involves registering service registry. 1 way, described on felix pages linked, using service component runtime. // osgi-inf/sample.xml <?xml version="1.0" encoding="utf-8"?> <component name="sample.component" immediate="true"> <implementation class="sample.service.samplecomparator" /> <property name="service.description" value="sample comparator service" /> <propert

c - Passing a URL to a specific piece of example code which extracts samples from a WAV file -

i don't know if legal on sof access such specific question, here go: i've found wonderful piece of code takes samples wav file , passes array. the code compiles, can't seem figure out pass argument of file , name is. any help? ps if code says does, think useful lot of people. thanks! if @ code it's reading stdin (and says in description above code: "it reads stdin" ). evidently it's designed used command line tool (or "filter") can piped other tools, or standalone using i/o redirection.

c# - Combinations of strings of n lists -

i want build combinations of strings in multiple lists. have 3 parameters included. these "and" , "or" , "equal" . for example, have following 3 lists: list 1 : "india", "china", "iran" list 2 : "hindi", "english", "chinese" list 3 : "forest", "desert", "river" the output should be india or hindi or forest india , hindi , forest india equal hindi equal forest india or china or hindi india , china , hindi india equal china equal hindi iran or english or river iran , english , river iran equal english equal river and on ... the number of lists , number of strings in lists not fixed. i'd prefer recursive solution. i think you'll first need create combinations of words , last step apply each of keywords between them. for each item in current list, if list last insert keywords, else recurse next list of words current.

Do closures in Javascript get a reference to the full outer function or do they only get references to the variables they actually use? -

just out of curiosity, closures in javascript reference whole "outer environment", or returned function analyzed see variables in outer scope references , gets references those? theoretically, nested function in javascript has access variables in containing scopes. when identifier encountered, resolved against scope chain , list includes objects properties variables , function parameters of each containing execution context (i.e. enclosing function), innermost first, plus global object @ end. function object drags scope chain around wherever goes. however, these variable objects , scope chain specification constructs , not accessible directly, implementations free make whatever optimizations like, including analyzing function code , exposing variables accessed function , functions nested within it, long specification appears satisfied. however, it's best assume if have enormous object accessible via closure function, enormous object going stick around @ lea

Problem bulk loading a csv file in Mysql using Python -

i loading file called 'rec.csv' mysql db. use code below: import mysqldb,os path='testdata' abspath = os.path.abspath(path) print abspath conn = mysqldb.connect(host='localhost', user='root', passwd='', db='iens') db_cursor = conn.cursor() query = "load data infile '"+ abspath + "/rec.csv" +"' table iens.recensies fields terminated ' ' lines terminated '\n' " db_cursor.execute(query) connection.commit() for reason can't find file! can see file exists, , when print path printing correctly. in end generates error: file "load_data.py", line 18, in <module> db_cursor.execute(query) file "/usr/lib/pymodules/python2.6/mysqldb/cursors.py", line 166, in execute self.errorhandler(self, exc, value) file "/usr/lib/pymodules/python2.6/mysqldb/connections.py&qu

database - Ruby on Rails - Getting "Mysql2::Error: Unknown column" for one to many relationship -

i have 2 models, model_1 , model_2. model_1.rb: has_many :model_2s model_2.rb: belongs_to :model_1 but when try @model_1.model_2s following error: actionview::template::error (mysql2::error: unknown column 'model_2.model_1_id' in 'where clause': select `model_2`.* `sketches` (`model_2s`.model_1_id = 1)) i have same problem using sqlite3. in advance help. the has_many default relies on conventions. has_many :model_2s would use column "model_1_id" in "model_2" table default find "model_1" belongs (hey, chose name of models ;)). seem missing column. for reasons unknown (unless provide migration files) table missing column.

iphone - Check if NSTimeInterval equals 0 -

//gets time right nsdate *now = [nsdate date]; //stores difference in seconds between when test started , now. nstimeinterval interval = [self.expires timeintervalsincedate:now]; if (interval == 0) { ... } any reason why condition wont true? thanks. since nstimeinterval double , might have floating point rounding error. try using if (abs(interval) < eps) { where eps small enough constant. or, if want know seconds , not milliseconds, can truncate double int. but judging code, think might want check if timeline has already expired , not expires @ exact moment. probability of later small. should trick. if (interval < 0) {

r - How do I save warnings and errors as output from a function? -

i'm using lapply run complex function on large number of items, , i'd save output each item (if any) warnings/errors produced can tell item produced warning/error. i found way catch warnings using withcallinghandlers (described here: https://stackoverflow.com/questions/4947528 ). however, need catch errors well. can wrapping in trycatch (as in code below), there better way it? catchtolist <- function(expr) { val <- null mywarnings <- null whandler <- function(w) { mywarnings <<- c(mywarnings, w$message) invokerestart("mufflewarning") } myerror <- null ehandler <- function(e) { myerror <<- e$message null } val <- trycatch(withcallinghandlers(expr, warning = whandler), error = ehandler) list(value = val, warnings = mywarnings, error=myerror) } sample output of function is: > catchtolist({warning("warning 1");warning("warning 2");1}) $value [1] 1 $warnings [1] &qu

c++ - Why does g++ store class names in the compiled binary? -

i noticed if run strings on program compiled g++ output contains names of various classes uses. the program compiled -o3 , without -g or -p , , class names still present when strip binary. i wondering why necessary g++ store information in binary? class names present seem classes use virtual functions, suspect it. this might have rtti , specifically, rtti allows query name of class of given variable. see typeid keyword. if case explain why happens classes have virtual functions - rtti works classes virtual functions.

ruby on rails - Is there a way to alias/anchor an array in YAML? -

i'm using jammit package assets rails application , have few asset files i'd included in each of few groups. example, i'd sammy , plugins in both mobile , screen js packages. i've tried this: sammy: &sammy - public/javascripts/vendor/sammy.js - public/javascripts/vendor/sammy*.js mobile: <<: *sammy - public/javascripts/something_else.js and this: mobile: - *sammy but both put sammy js files in nested array, jammit can't understand. there syntax including elements of array directly in array? nb : realize in case there 2 elements in sammy array, wouldn't bad give each alias , reference both in each package. that's fine case, gets unmaintainable when there 5 or ten elements have specific load order. your example valid yaml (a convenient place check ypaste ), it's not defined merge does. per spec , merge key can have value: a mapping, in case it's merged parent mapping. a sequence of mappings, in cas

excel - copy cells in a range to a column -

i have myrange = a1:c3 current values in range below: a1=a, b1=d, c1=f a2=b, b2=e, c2="" a3=c, b3="", c3="" the blank cells in range can vary. how can copy (using vba) non-blank values myrange , paste them let's column aa? eg: aa1=a aa2=b aa3=c aa4=d aa5=e aa6=f thanks again guys :-) paul iterate through cells in myrange, if cell not "" copy value next target cell sub test() dim myrange range dim targetcell range dim rw range dime cl range set myrange = activeworkbook.names("myrange").referstorange set targetcell = range("aa1") each rw in myrange.columns each cl in rw.cells if cl.value <> "" targetcell = cl.value set targetcell = targetcell.offset(1,0) end if next next end sub

database design - Please critique E-R diagram of datamodel -

i'm building data model website of student club @ university , need feedback on have far. every term students become members paying membership fee. membership fee entitles them attend club's activities less social events during term. attend these social events required purchase ticket. the club's activities involved courses of 8 10 weekly classes, workshops, , aforementioned events. we able model members every term , track registration , attendance courses ( registration ), individual classes ( attendance ), workshops ( attendance , registration), , events (attendance , registration). we want able see member of executive involved in activity. we want executive able upload articles (text), pictures, music, , video , control has access these items. used group solution because think granting access @ user/piece of content level tedious. please take , give me feedback. i'm trying design model easy maintain , adapt new requirements , robust, , flexible when c

javascript - Wrap jQuery, dojo with custom library? -

coming java, i'm wondering if java best practice applies javascript. in java, there's separation of interface , implementation, , mixing them considered bad practice. same token, recommended hide implementation details of library end developers. for example, log4j 1 of popular logging libraries out there recommended write code slf4j library or commons logging library "wraps" log4j. way, if choose switch logging framework such logback, can without changing code. reason you, user of logging library, how logging done none of concern, long know logging does. so javascript, non-trivial web applications have own custom javascript libraries, many of use open source libraries such jquery , dojo. if custom library depends on, jquery, not extension, implementation, see need add layer wraps jquery , makes transparent rest of javascript code? for example, if have foo library contains custom, front-end logic, you'd introduce bar library wraps jquery. way, foo libra

Apache Every subdomain points to same directory -

i have made wrong while creating virtual hosts on apache , everytime go some_random_subdomain.mysite.com, if subdomain not exist or if not applied redirects specific directory (which assigned specific subdomain) , don't know have stop it. please. have used *.domain.com anywhere? example: <virtualhost 111.222.33.4> servername domain.com serveralias *.domain.com </virtualhost> this cause virtualhost used subdomains don't have virtualhosts.

asp.net - comparing the old values vs new value and update -

note: havent implement above solution closing question , accepting answer thou havent implement. what best way of doing? , know can store repeater in different var , compare wanted know elegant way of doing. here for loop code want compare , update values have changed , ignore values have not changed gridviewrow row = gv.selectedrow; repeater _rpt = gv.rows[e.rowindex].cells[8].findcontrol("rptreg") repeater; repeater _rpt1 = gv.rows[e.rowindex].cells[9].findcontrol("rptvisitor") repeater; (int = 0; < _rpt.items.count; i++) { textbox _txt = _rpt.items[i].findcontrol("txtid") textbox; textbox _txt1 = _rpt.items[i].findcontrol("txtname") textbox; if (_rpt1.items.count > i) textbox _txt3 = _rpt1.items[i].findcontrol("txtvisitor") textbox; //update db } } it's total hack , i'm sure there mor

Connecting Flex application to Tomcat + Spring 3.0 Framework with BlazeDS -

i'm developing web application (client in flash builder 4, server in eclipse 3.6 + tomcat 7 + spring 3 framework). how make flex client automatically deploy in tomcat server , use blazeds messaging , remoting more seamlessly? check out free refcard on flex 4 , spring 3 integration .

java - Glassfish Server Webservice behind Apache HTTP Server -

hi started create our applications j2ee. created webservice , deployed glassfish server. have written apache proxy rule access via https://our.server.com/webservice-war (only https port open server): proxyrequests off proxypass /webservice-war http://our.server.com:8080/webservice-war proxypassreverse /webservice-war http://our.server.com:8080/webservice-war now works fine, when go to serviceendpoint page (which automatically generated) there link wsdl page: http://our.server.com:8080/webservice-war/hostaliassearchimplservice?wsdl which obously wrong (glassfish listens port 8080). , https changed http anyone idea how can fix it, automatically generated link is: https://our.server.com/webservice-war/hostaliassearchimplservice?wsdl br, rene i discovered consider simple , elegant way deal issue: use mod_substitute. since of problem using apache, , it's built in , simple, liked approach best. i put block similar below in 1 of apache conf files , found joy

c# - Why does this return zero results? -

i have list<list<string>> , when try search list<string> returns no results. any ideas? thanks list<list<string>> test = new list<list<string>>(); list<string> ff = new list<string>(); ff.add("1"); ff.add("abc 1"); test.add(ff); ff = new list<string>(); ff.add("2"); ff.add("abc 2"); test.add(ff); var result = test.where(x=>x.contains("abc")); //result.count(); 0 neither of lists contains element "abc". if want find lists have element contains "abc" substring can this: var result = test.where(x => x.any(y => y.contains("abc")));

PHP noob, creating registration system error -

i attempting write user registration system web site. running php 5 on web server , getting error: parse error: syntax error, unexpected ';' in /nfs/.../processreg.php on line 18 line 18: if (mysql_num_rows($s?>0)) the rest of code this: <?php include("db.php"); if (isset($_post['username']) && isset($_post['password']) && isset($_post['email'])) { //prevent sql injections $username = mysql_real_escape_string($_post['username']); $email = mysql_real_escape_string($_post['email']); //get md5 hash of password $password = md5($_post['password']); //check see if username exists $sql = mysql_query("select username usersystem username = '".$username."'"); if(mysql_num_rows($s?>0)) { die("username taken."); } mysql_query("insert usersystem (username, password, email) values ( '$username

c# - A substitute for ExpandoObject in .NET 3.5 with least overhead -

how can imitate functionality of expandoobject in .net 3.5 application least overhead? best lead far use lin fu framework ( http://www.codeproject.com/kb/cs/linfupart2.aspx ), i'm thinking there may better. to give better idea of going here, objective dynamically create type parameters of methodinfo . so, want turn this: public class serviceobject { public void execute(string transformmeintoaproperty); } into public class serviceobjectexecutesignature { public string transformmeintoaproperty{ get; set;} } at runtime. have able access parameters using reflection, because using linq expressions. you use codedom dynamically compile new types @ runtime. there's upfront cost of doing that....i suppose depends on lifetime of types generating. http://www.codeproject.com/articles/26312/dynamic-code-integration-with-codedom http://www.c-sharpcorner.com/uploadfile/mgold/codedomcalculator08082005003253am/codedomcalcula

iphone - UIBezierPath Path Shape Clickble and Draggable -

i have uibezierpath inside view. want show alert when click on shape, happens alert shown not when click within shape, when click anywhere within view. how change code when click inside colored shape, alert? also, how make shape draggable on screen? #import "draw2d.h" @implementation draw2d - (id)initwithframe:(cgrect)frame { self = [super initwithframe:frame]; if (self) { // initialization code. } return self; } - (void)drawrect:(cgrect)rect { uibezierpath* apath = [uibezierpath bezierpath]; [apath movetopoint:cgpointmake(200.053,79.688)]; [apath addlinetopoint:cgpointmake(100.053,179.688)]; [apath addlinetopoint:cgpointmake(304.412,280.125)]; [apath addlinetopoint:cgpointmake(308.055,298.513)]; [apath addlinetopoint:cgpointmake(200.053,79.688)]; [apath closepath]; [[uicolor blackcolor] setstroke]; [[uicolor redcolor] setfill]; cgcontextref aref = uigraphicsgetcurrentcontext(); cgcontexttranslatectm(aref, 50, 50); apath.linewidth = 5; [apath

.net - Regex for american phone numbers that will also pickup (123) space and 123 dot -

possible duplicate: a comprehensive regex phone number validation i've got this. 1?\s*-?\s*(\d{3}|\(\s*\d{3}\s*\))\s*-?\s*\d{3}\s*-?\s*\d{4} it matching lot of phone numbers, it's not catching these two: (123) 456-7890 or 123.456.7890 awhile asked question a regex number of digits in string. answer gave me regex (\d*\d){10}{n} . i've used phone number validation since then. not care format give me phone number in, long contains 10 digits. if care area code + phone number, may work well.

bash - execute terminal from c program -

to run c program this bash> gcc test.c -o test and then bash> ./test how can make test.c execute terminal in window?? xterm -e "./test" this execute 'test' in new xterm window. assuming linux of course.

real time - Implementing realtime apps on the iPhone? -

things presence notification needed im messenger apps have. kik , managed improve texting experience many-fold. if web application, comet implementation , run event loop server handle connections , keep either flash/web socket or long polling connection open on client (socket.io ftw). i'm not sure iphone, connections on 3g+wifi , all: - maybe nsurlrequest handles stuff , it's simple keeping long running long polling connection on background thread , register notifications onto it? anyways, appreciate pointers who's implemented realtime on iphone. well i'll respond other peoples' reference: you can use node.js socket.io basically, , implement long polling on iphone. there's library somewhere iirc, it's relatively simple implement yourself: implement state machine of sorts on phone switch between open request , getting data, fire off request. implement heartbeat (you don't want hit http timeout anyways) of 5 seconds, read socket.io

Installation independent visual-C++ project properties -

is there way adjust visual-c++ (ms vs 2010 ee) project properties in such way, same .sln files can built in 1 click among different computers (on windows, of course)? - possibly upload visual-c++ projects svn server. project uses libraries (header , .lib files) absolute (system dependent) path (e.g. boost) , it's own utils. you can use environment variables in project settings enclosing them in $(). e.g. if environment defines boost_include: set boost_include=c:\boost\include\boost-1_45 then can use $(boost_include) in settings refer boost include directory.

objective c - When does retain count for an autoreleased object decrement? -

if have autoreleased object, when retain count (i.e. value returned when call method retaincount on it) decrement? had figured when scope of method object allocated within ended, tests aren't indicating that. have code following: int itemindex = 0; nsarray* items = [mresponse componentsseparatedbystring:@","]; self.mtext = (nsstring*)[items objectatindex:itemindex++]; self.mtext = [mtext gtm_stringbyunescapingfromurlargument]; nslog(@"retain count: %d",[mtext retaincount]); this returns 2 count (mtext has retain property makes sense), , after exiting method, call outside likewise returns 2. don't @ retaincount . it's misleading. long follow memory management programming guide you'll fine. if rephrase question "when default autorelease pool drain?" answer when control flow returns runloop.

Specifying end of string sentinels in Python prior to constructing a suffix array -

i'm implementing algorithms in http://portal.acm.org/citation.cfm?id=1813708 utilize suffix arrays find longest common substrings. algorithms involve constructing suffix array string concatenation of set of given strings string separators called sentinels. example, if given strings a, b , c, new string d created a$1b$2c$3 $1, $2, $3 sentinel characters marking ends of each string. sentinel characters must unique , lexicographically less other characters in a, b , c. my question revolves around representation of sentinel characters in python. if a, b , c ascii strings, i'm thinking might need convert strings utf-8 , shift range 0-127 higher range such there characters available lexicographically less in strings. if seems reasonable, efficient mechanism remapping characters in python such range n-127+n n number of strings provided? i think should use tokenizer , replace each string integer. sentinels, there plenty of integers left over. probably, it's more con

javascript - HTML Canvas is rendering text slightly differently accross browsers -

i'm developing web application heavily relies upon knowing exact x , y location of each text character on canvas. problem different browsers aren't rendering each character same scale. the font using courier new , have tested in chrome 9, ff4 beta , chrome 9 beta. i know if there can done. also, due how browser handles text or purely canvas api? i remember article interoperability tests between different browsers. handling of fonts different in each browsers. there differences css , weight or rotation in transform. not think able achieve perfect rendering in each of them

android - Should I use a Service as a way of accessing network data? -

i'm new android development , i'm trying build simple app browse network dlna servers , allow me browse each dlna server directory. thought pretty simple: 1 activity displays dlna servers on network, user selects one, redirect activity browses dlna media server's directories. my question quite basic: how persist information 'selected server', 'current directory' , other things this? need way rest of application know do. should build data service? seems violates common understanding of services should be. how can i/should persist application state? you have few options. 1 think best pass these values in intent object you're sending 1 activity next. therefore, activity browses dlna media server's directories receives selected server in intent, , if came dlna list activity, that's great, intent come other activity wants show media server directories user. try hard encapsulate functionality inside activity doesn't need depend on re

optimization - Optimizing loop with few instructions(SSE2, SSE4) with TBB -

i have simple image processing related algorithm. briefly, image(mean) in float subtracted 8-bit image result save float image(dest) this function written intrinsics. i have tried optimize function tbb, parrallel_for, received no gain in speed penalty. what should ? should use more low-level scheme such tbb task optimize code ? float *m, **m_data, *o, **o_data; unsigned char *p, **src_data; register unsigned long len, i; unsigned long nr, nc; src_data = src->ubytedata; // 2d array m_data = mean->floatdata; // 2d array o_data = dest->floatdata; // 2d array nr = src->rows; nc = src->cols; __m128i xmm0; for(i=0; i<nr; i++) { m = m_data[i]; o = o_data[i]; p = src_data[i]; len = nc; { _mm_prefetch((const char *)(p + 16), _mm_hint_nta); _mm_prefetch((const char *)(m + 16), _mm_hint_nta); xmm0 = _mm_load_si128((__m128

facebook - Has the PyFacebook library been deprecated, discontinued or replaced? -

every link find tutorials leads me this: http://developers.facebook.com/search?q=user:pyfacebook_tutorial which doesn't work. couldn't find on facebook developers... closest guess replaced by: https://github.com/facebook/python-sdk anyone know sure? looks pyfacebook has been discontinued. facebook dev docs page links directly python-sdk project on github, interestingly there's no mention of python on sdk @ all.

c# - Form View how to check the mode -

hi i'm using asp:formview , need set inner control accessibility based on whether it's in insert or update mode. can tell me how find mode? actually found answer currentmode property

How to write an X86 extension -

i wondering if point me resources or overviews how x86 extensions made. research in how make custom extension in spirit similar x86-64, have idea may worthwhile (which won't go in @ time, don't ask), not sure information how done or research/learn on how it. thanks, peter architectures, such x86 , x86-64, not written in software, define hardware software runs on. x86 not code, rather, defines instruction set, how memory accessed, registers, etc. the architecture part of processor. literally need design , manufacture new processor make modification architecture itself. out of reach people.

internet explorer - How to check for the presence of a specific version of flash player, when the system has many versions with same "Major Version", (in javascript)? -

i have check if specific version of flash player 10.2.161.23 installed on client's machine or not javascript code. client's system has many other versions same "major version" 10.1.102.64 etc.. tried following code snippet for(var = 10; > 0; i--) { try { flash = new activexobject("shockwaveflash.shockwaveflash."+string(i)); } catch(e) { alert("in ctach"); } version = flash.getvariable("$version"); alert(version); } client has 10.1.102.64 & 10.2.161.23 on system , above code recognizing only, 10.1.102.64 not recognizing other version same "major version no:". can use new activexobject("macromediaflashpaper.macromediaflashpaper"); instead of shockwaveflash.shockwaveflash . have impact? flash player version want detect 64 bit

Remove Jquery AutoComplete Cache -

var collectionforautocomplete = new array(); function autocompletetextbox() { var data = collectionforautocomplete; //var ac = $("#setcommonelement_elementname").autocomplete(data); //ac.disable(); // ac.setoptions({ nocache: true }); $("#setcommonelement_elementname").autocomplete(data, { minchars: 0, width: 262, matchcontains: "word", scrollheight: 220, cachelength: 0 }); } function generatestringforautocomplete(commonelementcollectionlist) { if (commonelementcollectionlist.length > 0) { collectionforautocomplete.length = 0; (i = 0; < commonelementcollectionlist.length; i++) { collectionforautocomplete.push(commonelementcollectionlist[i].elementname); } } } in run time have loaded collection , push collection jquery autocomplet. cache not empty. please tell me how can clear cache........... try this: $("#setcommo

c# 4.0 - C# String.Format and object as argument -

here idea reading string .resx file and here sample of such string : "i writing {}" i wrote function pass values arguments. don't know number of arguments expected string public string myformattedstring (string resourcename, object param=null) { string fstr= resources.resourcemanager.getstring(resourcename); fstr= string.format(fstr, param); return fstr; } if call function myformattedstring ("resourcename", "nowhere"), not expecting what's wrong? i found solution issue using params object[] discovered public string myformattedstring (string resourcename, params object[] param) { string fstr= resources.resourcemanager.getstring(resourcename); fstr= string.format(fstr, param); return fstr; }

How to stop code execution while waiting for Wifi and Bluetooth adapters to enable in Android? -

i had manually turn on network adapters in program, , on android takes while hardware power up, second. //turn on network adapters wifimanager.setwifienabled(true); bluetoothadapter.enable(); while(wifimanager.getwifistate()!=wifimanager.wifi_state_enabled | bluetoothadapter.getstate!=bluetoothadapter.state_on) ; //no code here, waiting adapters enable //continue execution getdeviceinfo(); the above method i'm using not elegant @ all, cpu locked-up in while loop. ideas how implement in better way? at least, can put in thread (check out asynctask ) , have thread.sleep(10) in while loop. going deeper, can register broadcast events notified when wifi state changes. way, can react if outside app changes wifi state. broadcastreceiver s.