Posts

Showing posts from September, 2013

sql server 2012 - Calculate daily use from running total in c# -

i have sql-table following columns , trying find way automatically calculate daily usage each entry. 'total usage' running total , there entry once per day per person. ultimately want able manipulate list in c# sql-query based method useful well. easy in excel hoping way automate it.... date | name | total usage | daily usage 2016-01-01 | john | 60 | ? 2016-01-02 | john | 63 | ? 2016-01-03 | john | 66 | ? 2016-01-01 | jane | 30 | ? 2016-01-02 | jane | 50 | ? 2016-01-03 | jane | 75 | ? pertinent question, can result table using following code snippet written in c#, utilizes system.data , system.data.sqlclient object library: strsql = "select [name], avg([total usage]) avrusage [yourtablename] group [name]"; // data table 2 columns: name , avgusage using (sqlconnection _connsql = new sqlconnection(connstring)) { using (sqlcommand _commandsql = new (sqlcommand()) ...

c++ - What is application footprint and how to calculate it? -

what term "application footprint" means application developed in c/c++. , how can calculate c/c++ application footprint. it size in code, data , heap application needs. in linux, can check size of "text" (code), "data" , "bss" size a.out (replace a.out whatever application called). there similar tools windows. as heap needs, it's more complex, example loading full model of boeing 747 (every nut, rivet, bolt, seat , button on "tv remote") autocad takes more memory model of 2 bolts corresponding nuts through 2 plates of metal in same autocad system - same thing loading latest novel ken follet word processor different loading letter water company complain water leak in street. rough estimate, using typical use-case (e.g. model of small, still sophisticated enough meaningful).

How to modify dft function in opencv? -

i need modify of variables inside dft function in opencv make suitable application. where can find dft source code? i've tried c:\opencv243\build\include\opencv2\core.hpp gives me description of dft: //! performs forward or inverse 1d or 2d discrete fourier transformation cv_exports_w void dft(inputarray src, outputarray dst, int flags=0, int nonzerorows=0); what procedure after source code modification? have give different name such dft2() ? where save new function? i'm using visual studio 2010 , opencv 2.4.3 installed on windows7 (32 bit). please note i'm new opencv , switched matlab. therefore if willing help, grateful if explain clearly. in matlab right-click on function , see source file (for open source functions only). thanks payam dft function can found in dxt.cpp source file. located in $opencv2.3$\opencv\modules\core\src if save same function overwrite function , wont able use original function. if want new functio...

PHP Paypal REST Billing Agreement combined with Digital Item -

in paypal sandbox, when create billing plan & agreement setup_fee , user can complete billing process paypal , plan created if user's paypal account has no funds available. it appears setup_fee can take minutes after creation of plan & agreement until charges account. i know classic digital goods api it's suggested combine billing plan checkout digital goods item, user have authorize payment digital goods item & billing agreement together. way user can create billing profile if able pay digital goods item. still best practice? if so, how using new rest php sdk? is viable way it?: set plan when user starts checkout first billing amount being discounted price set billing agreement user authorise start date in hour list item once first payment cleared, run cron job update plan amount undiscounted rate next month's billing seems unbelievably complicated me can't see other way without forcing user authenticate twice (once authorise ...

Error in python 3.5: can't add `map` results together -

i have piece of code using python 2.7 , trying convert can use python 3.5 error on flowing code due map. best way resolve ? file "/users/newbie/anaconda3/lib/python3.5/site-packages/keras/caffe/caffe_utils.py", line 74, in parse_network blobs = top_blobs + bottom_blobs typeerror: unsupported operand type(s) + : ' map ' , ' map ' def parse_network(layers, phase): ''' construct network layers making blobs , layers(operations) nodes. ''' nb_layers = len(layers) network = {} l in range(nb_layers): included = false try: # try see if layer phase specific if layers[l].include[0].phase == phase: included = true except indexerror: included = true if included: layer_key = 'caffe_layer_' + str(l) # actual layers, special annotation mark them if layer_key not in network: network[layer_key] = [] top_blobs = map(str, laye...

Running a python script with nose.run(...) from outside of the script's directory results in AttributeError: 'module' object has no attribute 'tests' -

i have python application few sub directories. each subdirectory has own tests.py file. i use nose run of unittests across of these files in 1 shot, creating script run_unit_tests.py calls nose.run(...) . if inside of directory containing run_unit_tests.py , works fine. however, if anywhere else on file system, fails attributeerror: 'module' object has no attribute 'tests'. here similar directory structure: myapp/ foo/ __init__.py tests.py bar/ __init__.py tests.py run_unit_tests.py in run_unit_tests.py : class myplugin(plugin): ... if __name__ == '__main__': nose.run(argv=['', 'foo.tests', '--with-my-plugin']) nose.run(argv=['', 'foo.bar.tests', '--with-my-plugin']) if run run_unit_tests.py while inside top myapp directory, works fine. however, if run script while in other folder on file system, fails with: =============...

machine learning - Adaboost with neural networks -

i implemented adaboost project, i'm not sure if i've understood adaboost correctly. here's implemented, please let me know if correct interpretation. my weak classifiers 8 different neural networks. each of these predict around 70% accuracy after full training. i train these networks fully, , collect predictions on training set ; have 8 vectors of predictions on training set. now use adaboost. interpretation of adaboost find final classifier weighted average of classifiers have trained above, , role find these weights. so, every training example have 8 predictions, , i'm combining them using adaboost weights. note interpretation, weak classifiers not retrained during adaboost iterations, weights updated. updated weights in effect create new classifiers in each iteration. here's pseudo code: all_alphas = [] all_classifier_indices = [] initialize training example weights 1/(num of examples) compute error 8 networks on training set in 1 t: find cl...

ios - How to export one developer account when there are multiple developer accounts in a xcode profile -

i have mac has multiple developer accounts. out of want export 1 developer account mac. when try developer accounts getting exported profile. tried deleting other developer accounts. still gets exported. pls suggest how can done. you can select particular certificate developer account keychain access , export .p12 file , install in other mac use account in other mac.

Function for Range for floats in python -

i have define own floating-point version of range() here. works same built-in range() function can accept float values.start, stop, , step integer or float numbers , step non-zero value , can negative. i have tried looking answers on stackoverflow of them work positive step. keep getting stuck on test tests value (0,0.25,-1) i'm hundred percent sure there quicker , faster implement because program takes long time test values. can me create function , can't user imported tools. def float(start,stop,step): x = start my_list = [] if start < stop: while x<stop: my_list.append(x) if x < 0: x-=step elif x > 0: x+=step else: x+=step return my_list if start > stop: while x<=start , x>stop: my_list.append(x) if x < 0: x=step elif x > 0: x+=step else: x+=step return my_list the main r...

sql - case statement with expression throws error -

this question has answer here: missing keyword error in oracle case when sql statement 4 answers i trying execute below statement in oracle, throws error. kindly help. select a.phone_number, case a.phone_number when '2262070200' '2262070200' when a.phone_number = '2262070201' or a.phone_number = '2262070202' '2nd' end temp_a a; error : ora-00905: missing keyword data in temp_a 2262070200 2262070201 2262070202 2262070203 2262070204 2262070205 2262070206 2262070223 2262070224 2262070225 your query should this select a.phone_number, case when a.phone_number = '2262070200' '2262070200' when a.phone_number = '2262070201' or a.phone_number = '2262070202' '2nd' end temp_a a;

php - Symfony - Is it possible to edit twig templates using web editor -

we have website built on top of symfony framework , have been given task of allowing admins make changes email templates or twig templates via admin panel in wordpress go editor , make changes files. i know symfony not cms , wondering if allowing admins edit email templates , other twig templates @ possible do . templates not saved in database in normal location namebundle/resources/views and know on production symfony uses cache. while searching online came across ace editor , codemirror again stuck @ how use symfony i appreciate if can push me in right direction. i had same need recently. i chose put edited content in app/resources/acmebundle/views/include/menu.html.twig file because didn't want put in bundle. file src/acmebundle/resources/views/include/menu.html.twig loaded first time page loaded, content used basis editable twig template. file can empty. controller's function: /** * @route( * "/edit/menu", * name = ...

angular promise - angularjs chain http post sequentially -

in application, storing data in local storage , trigger async http post in background. once posted, posted data gets removed local storage. when http post in process, there may more data added local storage need queue post , sequentially process because, need wait local storage cleared successful posts. task should called recursively until there data in local storage. taskqueue: function () { var deferred = $q.defer(); queue.push(deferred); var promise = deferred.promise; if (!saveinprogress) { // post data storage var promises = queue.map(function(){$http.post(<post url>, <post data>).then(function(result){ // clear successful data deferred.resolve(result); }, function(error){ deferred.reject(error); }) }) return $q.all(promises); } as angular newbie, having problems above code not being sequential. how can achieve intend to? queue length unknown , queue length increases process in progr...

android - How to have a text view in my navigation drawer after menu items? -

i need have have text view after menu items, shouldn't responsive. needn't update programmatically. i'm using navigation drawer activity. create image out of text implementation of image view well. kind of this i don't know use code , version make navigation menu. have 3 suggestions you. 1 of them below code if use 'android.support.design.widget.navigationview' : <android.support.design.widget.navigationview android:id="@+id/nav_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start"> <linearlayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.navigationview android:id="@+id/navigation" android:layout_width="wrap_content" android:layout_height="0dp" ...

python - Convert string into hex to send for serial communication -

i have string numbers 5:240 . have send numbers string hex representation. number must in range of 2 bytes. but, want send exact representation on serial port '\x00\x05\x00\xf0' . can me out on this? i have tried following snippets no success: b='5:240' b = b.split(':') in range(len(b)): print hex(int(b[i])) print len(hex(int(b[i]))) result: 0x5 3 0xf0 4 output shows hex conversion not possible me send on serial port, cause length varying. can resolve issue? you can use hexadecimal format specifier, x : def word_hex(w): = int(w / 256) b = w % 256 return "{0:#0{1}x}{2:#0{3}x}".format(a,4,b,4).replace("0x", "\\x") b='5:240' b = b.split(':') in b: print(word_hex(int(i))) prints \x00\x05 \x00\xf0

php - How do I use my forked version of a repo in Composer? -

i working on project , ended having make small change 1 of packages i'm using. that package is: shopifyextras/shopify-php-api-wrapper can find here: https://github.com/shopifyextras/php-shopify-api-wrapper my previous composer.json file looked this: { "require": { "monolog/monolog": "1.*", "shopifyextras/shopify-php-api-wrapper": "^1.1" }, "autoload": { "psr-0": { "myapp\\": "src/" } } } after forking repo , making changes (i forgot create new branch first, created branch after committing master, , pushed github - don't think should cause issues given branch exists , point correct head), updated composer.json use fork. after reading composer docs ( https://getcomposer.org/doc/05-repositories.md#vcs ) updated composer.json following: { "minimum-stability": "dev", "prefer-stable" : true, "repo...

localization - Rails I18n. Set "en" default_locale with "es-CL" as locale -

i have 2 locale files: config/locales/en.yml config/locales/es-cl.yml i want use "en" default locale translate english language when "es-cl" translations missing. so, application.rb file: config.i18n.available_locales = ['en', 'es-cl'] config.i18n.default_locale = 'en' config.i18n.locale = 'es-cl' on production.rb config.i18n.fallbacks = true but, when start server, locales on english language. a chunk of es-cl.yml (the translation working when set config.i18n.default_locale "es-cl") es-cl: activerecord: models: admin_user: one: administrador other: administradores producer: one: productora other: productoras ticket: one: ticket other: tickets

debugging - Trigger xDebug in PhpStorm when calling using CURL -

so use curl command line make calls php website: curl -s "url" my question is...is possible modify command can trigger xdebug (combined ide (i use jetbrains phpstorm)) when calling site curl perhaps manipulate variables? the following code works me curl -i -x post -d '{"some":"data"}' http://your-local-domain -b xdebug_session=phpstorm

jquery - how to avoid endless animation triggered by multiple clicks on menu item -

i working on second site decided utilize jquery. got problem , can't resolve , neither find out solution on web. so, created 1 page site has menu , each item of triggers animation (horizontal movement + fadeout). clicking on second/third or fifth link, initial home page animations fading out, while clicking on "home", animations/images/etc. returning proper-initial places. though, if click on "home" twice or ten times, on each click, horizontally animated stuff moving endless assigned distances. so, questions are: 1. how should resolve problem - endless animation multiple clicks on "home" menu item; 2. how make other menu items work , find animated objects in initial places clicking on "home"? here code. sorry if find mess here - green in jquery. thank in advance :) <div id="nav"> <ul class="nav"> <li id="home"><a class="active" href="#">home</...

c# - TimeZoneInfo from timezone minutes offset -

from javascript have passed, controller, number of minutes user's client date time offset utc using method gettimezoneoffset on date object. have information on server side i'd create timezoneinfo it. how possible? if not possible how can convert utc dates on server side client's timezone using minutes offset? i'd create timezoneinfo it. how possible? it's not possible. time zone offset not same thing time zone . please read timezone tag wiki , section titled "time zone != offset". ... how can convert utc dates on server side client's timezone using minutes offset? create datetimeoffset represents moment in time. example: // database. make sure specify utc kind. datetime utc = new datetime(2013, 1, 1, 0, 0, 0, datetimekind.utc); // javascript int offsetminutes = 420; // don't forget invert sign here timespan offset = timespan.fromminutes(-offsetminutes); // final result datetimeoffset dto = new datetimeoff...

python - Model with instance won't save to DB but no error message in Django -

i'm having issue saving form instance. have model foreign key want save - nothing appearing in table , there doesn't appear error message. the model is: class aboutme(models.model): mygender = models.charfield(max_length=50, choices = gender_choices) class message(models.model): mysubject = models.charfield(max_length=100) mymessage = models.charfield(max_length=100) myfromid = models.foreignkey(aboutme) class contactform(modelform): class meta: model = message exclude = ('myread', 'mydeleted', 'myspam', 'mydate', 'mytime', 'myfromid', 'mytoid') mymessage = forms.charfield(widget=forms.textarea) def contact(request): myid = request.session["aboutme_id"] sender = aboutme.objects.get(pk=myid) if request.method == "post": message = contactform(request.post, instance=sender) ...

php - How do I create a Federated Table in Google Cloud SQL -

i have joomla (php) website existing hosted mysql database. have google cloud sql instance statistical data in. i need query data across both databases , query run on google cloud sql instance. my research far has lead me belive best way create federated table inside google cloud sql database in attempting not getting results expect (neither getting error?!) joomla mysql table: create table test_table ( id int(20) not null auto_increment, name varchar(32) not null default '', other int(20) not null default '0', primary key (id), index name (name), index other_key (other) ) engine=myisam default charset=latin1; google cloud sql: create table federated_table ( id int(20) not null auto_increment, name varchar(32) not null default '', other int(20) not null default '0', primary key (id), index name (name), index other_key (other) ) engine=federated default charset=latin1 connection='mysql://*uid*:*pwd*@*joomla_serv...

ruby on rails - Bootstrap navbar dropdowns not always working -

i using rails 4 , bootstrap 3 , having issues dropdown's in navbar consistently dropping down. i'm finding work pages (landing page) once navigate page navbar drop down no longer activate when clicked. i can supply whatever code helpful identify problem. i'm using twitter-bootstrap-rails gem @ bootstrap3 branch. thanks! this due turbolinks not trigger document.ready event. as said in other topic , can disable turbolinks 1 link adding data-no-turbolink='true' link tag, or application removing turbolinks gem. you can home-made patch: see here

emgucv - Getting Emgu CV Motion Detection sample working: Unable to load DLL 'opencv_legacy249' -

Image
i'm trying motion detection emgu cv example mentioned in the answer "looking function motion detection on emgucv" working. to example code working first needed add references emgu cv dlls emgu.cv , emgu.cv.ui , , emgu.util project make sure relevant open cv dlls (listed on the emgu wiki , found in c:\emgu\emgucv-windows-universal-gpu 2.4.9.1847\bin\x86 ) copied output executable directory of project change build target x86 when execution gets line in form1.cs _forgrounddetector = new bgstatmodel<bgr>(image, emgu.cv.cvenum.bg_stat_type.fgd_stat_model); it throws exception unable load dll 'opencv_legacy249': specified module not found. (exception hresult: 0x8007007e) . looking @ execution directory dll is there: what's going on? how fix this? fixed. i think had version clash. if take above steps motion detection example installs emgu cv, i.e. c:\emgu\emgucv-windows-universal-gpu 2.4.9.1847\emgu.cv.example\motiondetecti...

ExpressionEngine conditional based on Google Analytics URL tags -

i trying create conditional statement in expressionengine displays content based on utm_source variable in url google analytics campaign information. if, example, url "www.mysite.com/landingpage/?utm_source=one" content displayed and if url "www.mysite.com/landingpage/?utm_source=two" other content displayed. to started, tried: {if segment_3 == "?utm_source=one" } special {/if} but expressionengine not appear recognize url tag info 3rd segment. ideas how might approach this? thanks, -michael one found out today: mo variables then code this: {if "{get:utm_source}" == "one"} special {if:elseif "{get:utm_source}" == "two"} special {if:else} boring {/if} there others like one i've used before says on tin. whereas mo variables whole lot more.

cocoa - Xcode 5 throws "Library not loaded" error when adding a test target -

i've tried adding test target on xcode 5 using add target -> add cocoa touch unit testing bundle. however, when run test, following error: 2013-09-24 10:43:14.446 stack exchange[48895:c07] error loading /users/arielitovsky/library/developer/xcode/deriveddata/myapp-fjegcztcnwxqdfdimhonqzzqpdwr/build/products/debug-iphonesimulator/stack exchange tests.xctest/stack exchange tests: dlopen(/users/arielitovsky/library/developer/xcode/deriveddata/myapp-fjegcztcnwxqdfdimhonqzzqpdwr/build/products/debug-iphonesimulator/stack exchange tests.xctest/stack exchange tests, 262): library not loaded: /developer/library/frameworks/xctest.framework/xctest referenced from: /users/arielitovsky/library/developer/xcode/deriveddata/myapp-fjegcztcnwxqdfdimhonqzzqpdwr/build/products/debug-iphonesimulator/stack exchange tests.xctest/stack exchange tests reason: image not found idebundleinjection.c: error loading bundle '/users/arielitovsky/library/developer/xcode/...

dynamics crm 2011 - fetchXml: How to select accounts that *don't *have link entities of a specific type -

i want select accounts not n:n-related specific entity using fetchxml. tried following: <fetch mapping="logical" count="50" version="1.0"> <entity name="account"> <attribute name="name" /> <order attribute="name" /> <link-entity name="xy_accounthierarchynode" from="xy_accountid" to="accountid" link-type="outer"> <filter> <condition attribute="xy_accounthierarchynodeid" operator="null" /> </filter> </link-entity> </entity> </fetch> the expected result of query acounts don't have related xy_accounthierarchynode. receive accounts. filter conditions seems ignored... what did wrong? bad news not possible in crm 2011. getting accounts because using ...

c# - Using a jquery tooltip more than once on the same page -

i using jquery tooltip on asp.net repeater element. <div class="tooltip" style="display: none"> <div style="text-align: center; font-weight: bold;"> <%# eval("name") %><br /> </div> </div> $(function () { var du = 1000; var tooltip; $(document).tooltip({ show:{effect:'slidedown'}, items: "h5", content: function () { tooltip = $(this).siblings('.tooltip'); return tooltip.html(); } }); }); i have implement functionality. there should icon , on clicking on icon popup should open instructions , use jquery tooltip again. not know how implement time ,should include in same $function() above or should use function ? if has idea please let me know.. the way you've written it, shouldn't have more javascript. <h5> element has sibling tooltip class ac...

WPF BlurEffect Sluggish Performance and FPS -

in code have multiple blureffects applied multiple borders code similar following in onrender method: var blureffect = new blureffect(); blureffect.radius = 5; blureffect.renderingbias = renderingbias.performance; blureffect.kerneltype = kerneltype.gaussian; blureffect.freeze(); mainborder.effect = blureffect; however, when apply kind of effects multiple elements have noticed sluggish performance , drop of fps under 50. adding more borders effects makes worse. are there performance tricks can or alternative drawing method can use same blur effect on border, better performance?

jquery .next() skips selected elements separated by <br> tags -

Image
why doesn't jquery's .next() function return next selected item when items separated <br> tags? here's code taken jqueryui website demo area: <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>jquery ui button - icons</title> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css" /> <script> $(function() { $( "button:first" ).button({ icons: { primary: "ui-icon-locked" }, text: false }).next().button({ icons: { primary: "ui-icon-locked" } }).next().but...

ruby on rails - Why do I get permissions errors installing RVM? -

i followed rvm installation manual, , found system meets minimum requirements installation. i included user in /etc/sudoers . then ran: \curl -l https://get.rvm.io | bash-s stable - autolibs = homebrew - rails but installation process returned: % total % received % xferd average speed time time time current dload upload total spent left speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --: 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:100 184 100 184 0 0 156 0 0:00:01 0:00:01 --:--:-- 229 46 15779 46 7325 0 0 4433 0 0:00:03 0:00:01 0:100 15779 100 15779 0 0 9547 0 0:00:01 0:00:01 --:--:-- 8255k please read , follow further instructions. press enter continue. bash: line 584: /usr/local/rvm/release: permission denied` what i'm doing wrong? read other comments on forum, said correct install rvm console user, not...

java - Add an ArrayList<Boolean> to an Android Intent -

i'm attempting add arraylist<boolean> intent in android , retrieve it. there methods add , retrieve integer, string, etc. arraylists , intents , don't see arraylist<boolean> . now, i'm having convert arraylist<boolean> boolean[] , add intent, , convert arraylist<boolean> when retrieve intent. is there simpler way? call putextra(...) on intent, , throw in arraylist. when retrieving, cast returned value getserializableextra method call arraylist<boolean> . more info: http://developer.android.com/reference/android/content/intent.html#putextra(java.lang.string , java.io.serializable)

vbscript - random date time generation using VB script -

how generate date along time randomly between start date , end date using vb script. have take input user example: startdate:15/09/2013 9:00:00 enddate 21/09/2013 15:00:00 output : random date :17/09/2013 12:00:00 add random number of seconds less difference between dates in seconds startdate: dim startdate : startdate = #15/09/2013 9:00:00# dim enddate : enddate = #21/09/2013 15:00:01# dim secdiff : secdiff = datediff("s", startdate, enddate) wscript.echo startdate, enddate, secdiff dim n n = 1 20 wscript.echo dateadd("s", fix(secdiff * rnd()), startdate) next output (german locale): 15.09.2013 09:00:00 21.09.2013 15:00:01 540001 19.09.2013 18:49:56 18.09.2013 17:00:49 18.09.2013 23:55:40 17.09.2013 04:26:04 17.09.2013 06:17:32 20.09.2013 05:12:40 ...

java - Astyanax cql3 COUNT query returning ROWS not NUMBER -

according example page of astyanax: https://github.com/netflix/astyanax/wiki/cql-and-cql3 when run count query, result returns "number", can query with: try { operationresult<cqlresult<string, string>> result = keyspace.preparequery(cf_standard1) .withcql("select count(*) standard1 key='a';") .execute(); system.out.println("cql count: " + result.getresult().getnumber()); } catch (connectionexception e) { } and should give count result, querying table cql3 , isn't giving me "number", "rows", 1 row , 1 column. the method hasnumber gives false , method hasrows gives true , now, how can result of count query? you should use system.out.println("cql count: " + result.getresult().getrows().getrowbyindex(0).getcolumns().getcolumnbyname("count").getlongvalue());

iis 7 - MIME Type not working when added with appcmd -

when add mime type iis 7 via following code appcmd, shows in list doesn't work. appcmd set config /section:staticcontent /+"[fileextension='.mp4 ',mimetype='video/mp4']" if add via iis gui works expected. however, need script server deployment need know how make work appcmd. try appcmd.exe set config "default web site" -section:system.webserver/staticcontent /+"[fileextension='mp4',mimetype='video/mp4']"

xcode 5, Mountain Lion: Very slow performance -

Image
installed mountain lion , xcode5. tried open project developed ios6. , xcode dramatically slow. ideas whats wrong him now? edit it works fast new projects create. slows down when open old projects. ok. found problem. screen attached. when switch 'opens in' default 5, xcode changes ui presentations ugly ios7 design , xcode starts work fast in old times. switching 4.5 brings slow performance back. thats guys!

php - Redirecting incoming traffic from a referrer domain by country -

how can redirect incoming traffic specific domain when user specific country? for example: mexican traffic coming example.com site , chinese traffic coming newexample.com site , ... thank you [ ** edit more information ** ] i'm looking code redirects incoming traffic following example domains if traffic specified country in front of domain in list. please include example domains , destination redirect url in code provide: site1.com brazil >> redirect site2.com mexico >> redirect site3.com chili >> redirect site4.com argentina >> redirect site5.com columbia >> redirect site6.com india >> redirect site7.com india >> redirect thanks <?php $ip = $_server['remote_addr']; $url = "http://api.ipinfodb.com/v3/ip-city/?key=<api key>&ip=$ip&format=json"; $ch = curl_init(); // start curl curl_setopt($ch, curlopt_url, $url); // set url curl_set...

C++ still get segmentation fault (core dumped) error after change stack size with setrlimit -

i wrote c++ program in ubuntu. in main function, have 2-d array this: int main() { unsigned long long int s[11000][100]; // code manipulate s (just initialization) // ... } and program failed run. after search web, know size of 2-d array exceeds default stack size in ubuntu 8 mb. tried suggests change stack size automatically in program. added few lines of code: int main() { unsigned long long int s[11000][100]; const rlim_t kstacksize = 32 * 1024 * 1024; struct rlimit rl; int result; result = getrlimit(rlimit_stack, &rl); if (result == 0) { if (rl.rlim_cur < kstacksize) { rl.rlim_cur = kstacksize; result = setrlimit(rlimit_stack, &rl); if (result != 0) { printf("error\n"); } } else { printf("error\n"); } // code manipulate s (just initialization) // ... } // end main but still got segmentation fault (core dumped) error. checked stack size, s...

windows 7 - Machine continues to freeze -

as of lately, desktop has been freezing @ seemingly random times under no extraneous workloads. believe issue being caused firefox, unsure , need debugging situation. the machine has 2 hard drives; ssd partitioned dual-boot windows 7 , ubuntu 12.04, , standard hard drive partitioned hold basic windows documents (documents, desktop, downloads, etc.) , /home , /usr/local ubuntu. applications (at least windows) installed on ssd. the freezing issue on windows 7. seems occur randomly when browsing web using firefox. unsure if due filesystem setup have desktop or possibly corrupted installation of firefox (or other?). have never had issue before (on machine). should noted never experienced issue on machine before repartitioning ssd dual-boot. if there information can provide debug situation, please let me know. i have had problems in windows 7. used use firefox time lately seems firefox causing more , more memory issues. browsing in chrome never gives problems. had th...

selenium - How to handle the pop window to access the pop elements -

i'm having testcase handle popup control not going popup window. displaying gettitle of main window instead of popup window. can go through below code. @test public void testtext1() throws exception { driver.get("http://www.hdfcbank.com"); thread.sleep(8000); driver.findelement(by.xpath(".//*[@id='loginsubmit']")).click(); string popuphandle = driver.getwindowhandle(); webdriver popup; popup = driver.switchto().window(popuphandle); system.out.println(popup.gettitle()); if (popup.gettitle().equals("netbanking")) { system.out.println("i going access elements of popup"); driver.findelement(by.xpath(".//*[@id='wrapper']/div[6]/a/img")).click(); } else { system.out.println("worth trying try harder success"); // } } output: {d0f39d30-49e7-4203-b9ef-10380fbfcb5e} hdfc bank: personal banking services...

r - efficient vectorizisation of a double for loop -

how can 1 vectorize following double loop in r? a <- seq(1,10, length=5) b <- seq(0,1, length=4) fun <- function(a,b){return(a+b)} out <- matrix(nan, nrow=5, ncol=4) for(i in 1:5) { for(j in 1:4) { out[i, j] <- fun(a[i], b[j]) } } i have attempted, example, without success. please advise, in advance outer(1:nrow(out), 1:ncol(out), fun = fun(a,b)) mapply(out, fun) what about: outer(a, b, '+') ## > outer(a, b, '+') ## [,1] [,2] [,3] [,4] ## [1,] 1.00 1.333333 1.666667 2.00 ## [2,] 3.25 3.583333 3.916667 4.25 ## [3,] 5.50 5.833333 6.166667 6.50 ## [4,] 7.75 8.083333 8.416667 8.75 ## [5,] 10.00 10.333333 10.666667 11.00

canvas - Get doubletap coordinates in c# windows phone 8 -

i'm trying best coordinates of finger doubletapped when doubletapped somewhere on canvas, how can accomplish this? have doubletap method this: private void app_doubletap(object sender, system.windows.input.gestureeventargs e) { //get coordinates(left , top) of doubletapped } please me , lot in advance!:) to position relative page, use: point point=e.getposition(this); to position relative canvas (with double tap event regitered on canvas), use: point = e.getposition(sender uielement);

java - making the app work for all android versions -

i have created jsonobject pulls data server works on android versions less 3 (old ones). code make work on versions?? protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); defaulthttpclient client; client = new defaulthttpclient(); httpget = new httpget("http://saurabhgoyal.comoj.com/json_test.php"); httpresponse r; try { r = client.execute(get); httpentity e = r.getentity(); inputstream is=e.getcontent(); inputstreamreader isr=new inputstreamreader(is); bufferedreader reader=new bufferedreader(isr); string results=reader.readline(); toast.maketext(this, results, toast.length_short).show(); } catch (clientprotocolexception e1) { // todo auto-generated catch block toast.maketext(this, "failure", toast.length_short).show(); e1.printstacktrace(); } catch (ioexception e1) ...

ios - When is the right time to animate and add sublayers in an UIView subclass -

if create subclassed uiview , want use bunch of custom made content (animations via cabasicanimation using cashapelayer s, custom made drawings using cgcontextref in drawrect ) when right time create, add , animate sublayers? i know should perform custom drawings in drawrect method (and since there place when can uigraphicsgetcurrentcontext() kinda narrows choice down). have been creating sublayers, animations , other non-drawing related stuff in drawrect well. i'm not sure drawrect best place kind of activities. i familiar layoutsubviews method , other uiview methods haven't implemented of them except drawrect . so if repeat myself 1 more time - question goes: add sublayers, animate them , there tricks or catches should aware of? you can create , add layers @ init, if permanent. if dynamic, layoutsubviews better. means need setneedslayout whenever new layer/item required. can mix , match as want between -init , -layoutsubviews, if had pick, i'd...

visual c++ - Copy Constructor for MyString causes HEAP error. Only Gives Error in Debug Mode -

so, i've never experienced before. when error, triggers breakpoint. however, time when build solution , run without debugging (ctrl+f5), gives me no error , runs correctly. when try debugging (f5), gives me error: heap[mystring.exe]: heap: free heap block 294bd8 modified @ 294c00 after freed windows has triggered breakpoint in mystring.exe. may due corruption of heap, indicates bug in mystring.exe or of dlls has loaded. may due user pressing f12 while mystring.exe has focus. output window may have more diagnostic information. this assignment due tonight, i'd appreciate quick help. my code here: https://gist.github.com/anonymous/8d84b21be6d1f4bc18bf i've narrowed problem down in main line 18 in main.cpp ( c = + b; ) concatenation succeeds, when copied c, error message occurs @ line 56 in mystring.cpp ( pdata = new char[length + 1]; ). the kicker haven't had problem line of code until tried overloading operator>>. i've since scrapped code s...

Maya M.E.L : Is it possible to store an array of type joint? -

hi new mel user , have been playing around , searching around can't figure out: i trying move joint transform rotation values joint orient values can clean attributes of transforms without losing joint orientation, mel attempt this: string $joints[]=`ls -type "joint"`; //print($joints); int $jnt_count = size($joints); ($i = 0; $i <= $jnt_count; $i++) { int $attr1 = `getattr $joints[i].rotatex`; int $attr2 = `getattr $joints[i].rotatey`; int $attr3 = `getattr $joints[i].rotatez`; setattr $joints[i].jointorientx $attr1; setattr $joints[i].jointorienty $attr2; setattr $joints[i].jointorientz $attr3; } i hoping array of joints (names), change attributes in manner calling them 1 one, seems cannot way however! when objecttype $joints[1] test, still return type "joints" , don't why value of array type joints, can't access joint's joint.xxx attributes, can enlighten me on matter or point me in right direction...

permissions - Android - dynamically request camera access -

i want add following permissions android app, doing block 500 devices supported in current build: <uses-permission android:name="android.permission.camera"/> <uses-feature android:name="android:hardware.camera" /> <uses-feature android:name="android.hardware.camera.front" android:required="false" /> <uses-feature android:name="android.hardware.camera.autofocus" /> is there way conditionally request access camera os's , not others? way achieve release 2 apps? if app uses camera but it's not mandatory feature, can set required attribute false , did second feature.- <uses-permission android:name="android.permission.camera"/> <uses-feature android:name="android:hardware.camera" android:required="false" /> <uses-feature android:name="android.hardware.camera.front" android:required="false" /> <uses-feature android:name...

r - How can I put a transformed scale on the right side of a ggplot2? -

Image
i'm creating graph showing change in lake levels on time. i've attached simple example below. add scale (tick marks , annotation) on right side of plot shows elevation in feet. know ggplot2 won't allow 2 different scales (see plot 2 y axes, 1 y axis on left, , y axis on right ), because transformation of same scale, there way this? i'd prefer keep using ggplot2 , not have revert plot() function. library(ggplot2) lakelevels<-data.frame(day=c(1:365),elevation=sin(seq(0,2*pi,2*pi/364))*10+100) p <- ggplot(data=lakelevels) + geom_line(aes(x=day,y=elevation)) + scale_y_continuous(name="elevation (m)",limits=c(75,125)) p you should have @ link http://rpubs.com/kohske/dual_axis_in_ggplot2 . i've adapted code provided there example. fix seems "hacky", gets part of way there. piece left figuring out how add text right axis of graph. library(ggplot2) library(gtable) library(grid) lakelevels<-data.frame(day=...

c# - How can I use Code Contracts to ensure that a non-blank, non-null val should always be returned from a method? -

this code: private static char getbarcodechecksumwithlegacycode(string barcodewithoutczechsum) { contract.requires(!string.isnullorwhitespace(barcodewithoutczechsum)); contract.ensures(contract.result != null); . . . ...doesn't compile (" operator '!=' cannot applied operands of type 'method group' , '' "). this fails same way: contract.ensures(contract.valueatreturn != null); how can enforce necessity of method returning result using code contracts? update if this: contract.ensures(contract.result<char>() != ''); ...it fails with, "empty character literal" so way test returned char val being both non-null , non-empty: contract.ensures(contract.result<char>() != null && contract.result<char>().tostring() != string.empty); ...or null check suffice? btw, trying use valueatreturn instead of result gives me " no overload method 'valueatreturn' takes 0 arg...

Rails: how set ID or Name attribut in text_field_tag? -

<%= text_field_tag :barcode, params[:barcode] %> it generate <input id="barcode" name="barcode" type="text"></input> but need <input type="text" name="barcode" id="autocomplete"></input> but in documentation did not find way how change id attribute. i need use text_field_tag because fills textbox params if submit fail. if think im worry if change id not fill param ?! try this <%= text_field_tag :barcode, params[:barcode], id: 'autocomplete' %>

python - Beautiful Soup throws `IndexError` -

i scraping website using python 2.7 , beautiful soup 3.2 . new both languages, documentation got bit started. i reading next documentations: http://www.crummy.com/software/beautifulsoup/bs3/documentation.html#contents http://thepcspy.com/read/scraping-websites-with-python/ what , have (part fails): # import classes needed import urllib2 beautifulsoup import beautifulsoup # url scrape , open urllib2 url = 'http://www.wiziwig.tv/competition.php?competitionid=92&part=sports&discipline=football' source = urllib2.urlopen(url) # turn saced source beautifulsoup object soup = beautifulsoup(source) # source html page, search , store <td class="home">..</td> , it's content hometeamstd = soup.findall('td', { "class" : "home" }) # loop through tag , store needed information, being home team hometeams = [tag.contents[1] tag in hometeamstd] # source html page, search , store <td class="home">..</...

css - Mootools not show colspan td in tr hidden -

i want hide information in hidden row shown no respect colspan. have: <table width="100%" cellpadding="0" cellspacing="0" border="1"> <tr> <td><div id="se">click here!!</div></td> <td>value 2</td> <td>value 3</td> </tr> <tr><td colspan="3" style="display:none;;">content</td></tr> and mootools code $('se').addevent('click',function(){ this.getparent('tr').getnext('tr').getelement('td').setstyle('display','block'); }); when click on "click here!" hidden row shown, not colspan. see example here: http://jsfiddle.net/xvnhw/1/ this not mootools browser repaint of element has not considered rendering before. move using css based setup, gets applied after engine parses cells , sets correct position. http://jsfiddle.net/xvnhw/3/...

Can you do sorting and grouping for the search results in solr using the solr config files? -

assume indexed fields includes: product name product type product release date assume solr request handler type dismax. is possible sort , group search results in solr search engine using solr config files, schema.xml , solrconfig.xml? for example, when search spider man, if search results came products of spider man dvds , spider man comic books, , mixed 1 after this: spiderman1, dvd spiderman1, book spiderman2, book spiderman3, dvd spiderman4, book is possible group results, dvds next each other , books next each other using solr config files? if yes, can give example of how it? also possible sort result putting recent released dvds , books show on top of result using solr sonfig files? if yes, can give example of how it? solr supports grouping (also called field collapsing) allow group results per product type. configuration can added default request handler defination in solrconfig.xml applied always. <requesthandler name="/browse" class=...