Posts

Showing posts from March, 2013

Angularjs typescript migration -

i have sizeable angularjs application migrate angular 2. i want to take whatever steps can make future migration easier. i converting controllers , services typescript , organising files in component-oriented folder structure. what able use es6 style module loading. i understand system.js can provide loading functionality , can use es6 import syntax in typescript 1.5. my question is, how should use 2 together? should output es6 modules typescript , use system.js module loading generated code? or other step required? should output es6 modules typescript , use system.js module loading generated code i output commonjs modules , use system.js @ moment. note system.js module output going arrive in typescript 1.6. see roadmap : https://github.com/microsoft/typescript/wiki/roadmap#16

sql server 2008 - How do I remove unknown characters in a string? -

i delete parts of string . we have table: locations mk-mk=new york; sq-al=nej york; en-us=new york mk-mk=london; sq-al=london; en-us=london mk-mk=paris; sq-al=paris; en-us=paris i want remove , keep sq-al=locationname . i want result be: sq-al=nej york; sq-al=london; this yet example of importance of normalized databases. in normalized database have table 2 columns, 1 culture (sq-al, en-us etc`) , 1 value. go step further , have cultures in lookup table. however, since not case have use string manipulations value of specific culture. can use substring , charindex find specific pattern want. work in of cases represented sample data i've listed. -- create table , insert sample data create table location ([name] varchar(100)) insert location ([name]) values ('en-us=huston; mk-mk=huston; sq-al=huston;'), -- end of row, ending ';'. ('en-us=new york; mk-mk=new york; sq-al=nej york'), -- end of row, without ending ';'. ('

How to Do Enter For Space in array of char in c++? -

my code here: char s[50]; cin.get(s,50); (int = 0; < 50; i++) { if (s[i] = ' ') { //suppose enter } } cout << s << endl; input: welcome c++ expected output : welcome c++ this work: char s[50]; cin.get(s,50); (int = 0; < 50; i++){ if (s[i] == ' '){ s[i]='\n'; //suppose enter } } cout << s << endl;

c++ - Splitting a line into token with find() -

i want split line : cmd1; cmd2; cmd3 into 3 strings stock list. like cmd1 cmd2 cmd3 so made code : main.cpp #include <string> #include <iostream> #include <list> int main() { std::string line("cmd1; cmd2; cmd3"); std::list<std::string> l; size_t pos = 0; size_t ex_pos = 0; while ((pos = line.find(';', ex_pos)) != std::string::npos) { l.push_back(line.substr(ex_pos, pos)); ex_pos = pos + 2; } l.push_back(line.substr(ex_pos, pos)); (std::list<std::string>::iterator = l.begin(); != l.end(); ++it) { std::cout << *it << std::endl; } return (0); } but don't know why returns me : cmd1 cmd2; cmd3 cmd3 second argument of substr not index of lat character copy. length of target substring. l.push_back(line.substr(ex_pos, pos-ex_pos)); http://www.cplusplus.com/reference/string/string/substr/

bash - Send stderr/stdout messages to function and trap exit signal -

im working on error handling , logging in bash script. below have included simplified code snippet exemplify use case. i want achieve following in script: trap exit signals should trigger onexit() function in code below stderr , stdout should sent log() function make sure log output log file according specific log format (simplified in example below) issue current code below: step 1 not trapped onexit function , script continuing step 2. because stderr piped logstd(). how can send error messages logstd() still trap exit signal in onexit()? resolution: add set -o pipefail get exit status on onexit() adding local exit_status=${1:-$?} script.sh (edited after resolution) #!/bin/bash -e set -o pipefail # perform program exit housekeeping function onexit { local exit_status=${1:-$?} log "onexit() called param: $exit_status" exit $1 } # simplified log function sends input parameter echo. function used within script # in real case function s

laravel - Can't format datetime in carbon -

when try format $date d/m/y it's work fine $date = '20/4/2015'; carbon::createfromformat('d/m/y', $date) but when try format $date d/m/y $date = '20/4/2015'; carbon::createfromformat('d/m/y', $date) i got error following, the separation symbol not found trailing data what wrong in code? m means textual representation of month. 4 cannot parset month , fails though strange message. try , works $date = '20/jan/2015'; $carbdate=carbon::createfromformat('d/m/y', $date); dd($carbdate); outputs carbon {#260 ▼ +"date": "2015-01-20 10:01:01" +"timezone_type": 3 +"timezone": "utc" }

html - SVG animation transform origin propety is not working different browsers -

this question has answer here: transform-origin css animation on svg working in chrome, not ff 2 answers i facing issue transform origin property in firefox , safari. here link have done far : http://jsfiddle.net/hassanpervaiz/alfhfstt/ hers html svg , css code : .st0{fill:#55b948;} .st1{fill:none;stroke:#55b948;stroke-miterlimit:10;} path#small-nid { -webkit-animation: spin 4s infinite; animation: spin 4s infinite; -webkit-transform-origin: 89px 88px 0; -ms-transform-origin: 89px 88px 0; transform-origin: 89px 88px 0; -webkit-animation-timing-function: steps(8); animation-timing-function: steps(8); } path#big-nid { -webkit-animation: spin 1.5s infinite; animation: spin 1.5s infinite; -webkit-transform-origin: 89px 88px 0; -ms-transform-origin: 89px 88px 0; transform-origi

android - Display Window on top of any app AND status bar but not appear on lock screen? -

to display window on top of status bar (and accept touch events), seems type_system_error way go. however, such window appear on lock screen, not want happen. is there other way achieve this? if not, there way listen event lockscreen becomes visible, can hide window programmatically? please note: app not have activity context.

java - Combine output of two different buttons -

i writing code vending machine , have button layout of letters , numbers. right now, if press "a" button, prints "a" box, if press "1" button, replace "a" that's in box , print "1" in place. how can make output "a1" instead of 1 or other? string buttontext = ""; for(int = 0; < 12; i++) { if(event.getsource() == button[i]) { jbutton clickedbutton = (jbutton) event.getsource(); string buttontext1 = clickedbutton.gettext(); buttontext += buttontext1; itemselection.settext(buttontext); at time won't able click more 1 button. instead of code: string buttontext = ""; for(int = 0; < 12; i++) { if(event.getsource() == button[i]) { jbutton clickedbutton = (jbutton) event.getsource(); string buttontext1 = clickedbutton.gette

vb.net - How to calculate the sum of a column from set of rows based on a condition in gridview? -

visit http://i.stack.imgur.com/pwgf3.png i new vb.net , want find sum of quantity batchids equal. in example, answer should 'pan-new'= 4,vsd-1850=2 aim check result current stock before invoicing. how in vb.net? please me loop through datagridview , check if row satisfies condition add. for each row datagridviewrow in datagridview1.rows if row.cells(2).value = "pan-new" quantitysum = quantitysum + integer.parse(row.cells(4).value) end if next

Not able to append data to a file using php -

i new php , in learning process. tried writing data file , worked. now tried adding data added user file in append mode, have not idea why not working out. code : <?php if(isset($name)){ $name=$_post['data']; if (!empty($name)) { $handle=fopen("name.txt", 'a'); fwrite($handle, $name."\n"); fclose($handle); echo "added file sucessfully !"; }else{ echo "please enter name in text box !"; } } ?> <form action="nwfile.php" method="post"> <input type="text" name="data"> <input type="submit" value="submit"> </form> i not able find issue code , have no idea why no data getting written in file. try use if(isset($_post['data'])){ <?php if(isset($_post['data'])){ $name=$_post['data']; if (!empty($name)) { $handle=fopen("name.t

html - Django doesn't load css files -

i testing django project locally. templates , static files listed: static/ css/ js/ ... templates/ home.html ... when run server, html file loaded firefox indicate that: this xml file not appear have style information associated it. document tree shown below. the html links in templates like: <link rel="stylesheet" href="/static/css/bootstrap.min.css" type="text/css"/> however, when input 127.0.0.1:8000/static/css/bootstrap.min.css in browser, file exists , can fetched. [26/apr/2015 06:47:38]"get / http/1.1" 200 10125 [26/apr/2015 06:47:49]"get /static/css/bootstrap.min.css http/1.1" 200 117150 i have go through postings on topic, have done things below: settings.py have installed_apps: installed_apps = ( 'django.contrib.admin', ... 'django.contrib.staticfiles', 'frontend', 'crawler', } my urls.py pasted here: from django.conf.urls

apache - Symfony2 : 404 Not Found without app.php -

this htaccess in public_html directory : directoryindex app.php <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{request_uri}::$1 ^(/.+)/(.*)::\2$ rewriterule ^(.*) - [e=base:%1] rewritecond %{http:authorization} . rewriterule .* - [e=http_authorization:%{http:authorization}] rewritecond %{env:redirect_status} ^$ rewriterule ^app\.php(/(.*)|$) %{env:base}/$2 [r=301,l] rewritecond %{request_filename} -f rewriterule .? - [l] rewriterule .? %{env:base}/app.php [l] </ifmodule> <ifmodule !mod_rewrite.c> <ifmodule mod_alias.c> redirectmatch 302 ^/$ /app.php/ </ifmodule> </ifmodule> and /etc/apache2/sites-available/mydomain_com.conf : <virtualhost *> serveradmin webmaster@mydomain.com servername mydomain.com serveralias www.mydomain.com # indexes + directory root. documentroot /home/myuser/domains/mydomain.com/public_html #

java - What is the point of overriding the getInsets() method? -

i'm looking @ documentation javax.swing.jcomponent , , method stuck out me because trying create subclass of type. there point in overriding getinsets() ? purpose of method when have getpreferredsize() ? getinsets defines space can taken content, borders, is, generally, added preferredsize , offsets position (translates) of graphics context, ensure actual content painted instead insets . personally, unless intend prevent modifying state of components borders or thinking providing margins of sort, i'd leave alone (and not override it)

ios - Getting app freeze and cell becomes empty when prepareForReuse used -

i have tried prepareforreuse app getting stuck while scrolling , cell empty. there wrong i'm doing? subviews added in xib. guide me proper solutions. static nsstring *cellidentifier1 = @"pollcell"; ixpollcustomcell *pollcell = (ixpollcustomcell *)[tableview dequeuereusablecellwithidentifier:cellidentifier1]; if (pollcell == nil) { pollcell = [[[nsbundle mainbundle] loadnibnamed:@"ixpollcustomcell" owner:self options:nil] objectatindex:0]; pollcell.selectionstyle = uitableviewcellselectionstylenone; ixpollcustomcell.m - (void)prepareforreuse { [[self.contentview viewwithtag:2001] removefromsuperview]; //does not crash if view nil. it's okay send messages nil in objc } ixpollcustomcell.h @property (weak, nonatomic) iboutlet uiview *multichoiceview; @property (weak, nonatomic) iboutlet uiview *multioption1view; @property (weak, nonatomic) iboutlet uilabel *choice1ratelabel; @property (weak,

Where to put tumblr html code to open permalinks in new tab -

i've searched around , figured need add target="_blank" i'm not sure where. i've tried placing @ various places after <a href="{permalink}" didn't seem anything i want have when clicks on post/photo on main page it'll open permalink of post in new tab. here complete html: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><html><head> <title>{title}</title> <meta name="description" content="{metadescription}" /> <link rel="shortcut icon" href="{favicon}"> <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1"> <link rel="alternate" type="application/rss+xml" title="rss" href="{r

smartcard - How to change master key of DESfire cards?What is deciphered key? -

i want change master key of desfire card. read mifare desfire datasheet already, new in field, couldn't understand it. it explained how change key @ page 37 of above document. can give me example or step step tutorial changing keys? (including associated apdu commands) what deciphered key mentioned in document? shall decipher new key , use in command? if so, how decipher key data? your decipheredkey cbc-mode decrypted value of new key 0 initial vector. this mifare desfire feature: terminal always decrypts (even hide plaintext!) , desfire card always encrypts . based on fact, decryption , encryption using symmetric ciphers des, 3des or aes inverse functions, can both used both hiding , revealing plaintext. it helps improve performance - desfire card not have switch cipher mode encryption decryption each apdu. see page 12 of document.

javascript - Fullscreen video to open website and dissolve -

i youtube video opener (26 seconds, fades black,then 4 second tail of black) automatically play full screen when going website , after 26 seconds dissolve home page. video have on it's own page or on home page in order dissolve work? you embed youtube video on page. css set to: position: fixed; left: 0; top: 0; right: 0; bottom: 0; you can handle timer javascript, handle fading css opacity transition (starting @ opacity: 1.0 , when want fade set opacity: 0). and after 30 seconds have js timer removes it.

c++ - Glew does not init -

i using following code check error: glfwinit(); glewexperimental = gl_true; if (glewinit() != 0) { std::cout << "failed initialize glew" << std::endl; return -1; } i using non static version of glew , have included .dll file in debug folder. using visual studio community 2013. other solutions suggested set glewexperimental gl_true or check error checking, have done , still not work. you don't have gl context glfwinit() , glew has nothing work on. must create gl context , make current thread, glfw implies creating window.

python - How to get a different output in textbox then what the user enters -

i started using tkinter , , question how different output in widget user enters. gui prints whatever user types in entry box , prints user types textbox. how go making if word entered in entry box sentence printed instead of actual word. example: user types in "cat" , prints "hello heard cats" in textbox this current code: from tkinter import * import sys class display(frame): mgui = tk() mgui.geometry("500x500-500-300") mgui.title("gui") mlabel = label(mgui, text="welcome").pack() def __init__(self): frame.__init__(self) self.entry = entry(self) self.entry.pack() self.entry.bind("<return>", self.onenter) self.clearbutton = button(self, text="clear text", command=self.clear_text) self.clearbutton.pack() self.output = text(self) self.output.pack() sys.stdout = self self.pack() def onenter(self,

Double Linked List Deleting Node with Index C++ -

[enter link description here][1]so, i've been having issues program i'm working on. i'm new programming, i'm determined in learning language. i have use these 3 different structs in program, pointers starting trip me up. function must return new updated songlist . what have written far. problem nothing getting deleted, it's being overwritten within function. if please show how appreciated. i've taken out few of functions , switch statements condense post. main goal when remove function selected ask user pick index of song it'd deleted. when function called it'll take index , songlist parameters. remove node , return list. i have use these 3 different structs in program, pointers starting trip me up. well, starters, in c++, should using std::list class, , let manage pointers you. the function must return new updated songlist . you not returning updated list, returning first node in updated list. in of redundant, because retu

javascript - angular tutorial not working on fiddle -

Image
i've been reading angularjs tutorials on tutorialspoint.com , i've been testing things learn on jsfiddle. first few things tried worked, ng-model , ng-bind . empty ng-app ( ng-app="" ). however, i'm trying make app , controller, not working. heres fiddle how fix code? i've done tutorial says. noticed when inspecting page following error: error: [$injector:modulerr] failed instantiate module myapp due to: [$injector:nomod] module 'myapp' not available! either misspelled module name or forgot load it. if registering module ensure specify dependencies second argument. <div ng-app="myapp" ng-controller="appcontroller"> <div> <span>first</span> <input type='text' ng-model="person.firstname"/> <span ng-bind="person.firstname"></span> </div> <div> <span>last</span> <input t

c++ - LLVM tutorial 3.6 linker error when trying to compile output from chapter 8 -

i working through llvm tutorial: http://llvm.org/releases/3.6.0/docs/tutorial/index.html the code chapter 8 compiles fine , emits ir unable compile emitted ir. code listing copy , pasted reduce chances have typo in code somewhere. thing have modified build command since llvm-config defaults older version. build command: clang++ -g -o3 toy.cpp `llvm-config-3.6 --cxxflags --ldflags --system-libs --libs core mcjit native` -o toy to run (i removed & original command since seems throw error): ./toy < programs/basic.ks | clang-3.6 -x ir - the output listed below: ; moduleid = 'my cool jit' target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-s128" declare double @printd(double) define double @main() { entry: %calltmp = call double @printd(double 4.200000e+01), !dbg !14 ret double %calltmp, !dbg !14 } !llvm.module.flags = !{!0, !1} !llvm.dbg.cu = !{!2} !0 = !{i32 2, !"debug info version", i32 2} !1 = !{i32 2, !"dwarf version&q

Python: Functions in while loops -

i told functions useful when want execute same piece of code numerous times... when dealing while loops, functions necessary. i'm not sure whether call functions in while loop text - based adventure game have make school. after why need functions in loop when repeated until exit loop. teacher mark me down having unnecessary functions? on side not well: how change variables in main routine within function... want subtract 1 num_water variable (global num_water -= 1) says invalid syntax highlighting equal symbol – william- consider simple c-based state machine, 1 function runs state machine, , based on current state dispatch out number of functions. state machine runs forever, in bool done=0; while(done == no) { switch(state) { case some_state: do_thing_for_this_state(); break; case other_state: ... } } a while loop conceptually no different: while (done == no) { things } if "do things" block simple, , code can read , understood, le

database - After I restart PostgreSQL all my tables are empty (zero rows) -

using mac os x 10.10 (yosemite) , homebrew (0.9.5), i've installed postgresql 9.4.1. current versions of time of posting... i've managed import brutally large database (56m records - 15 hours import), , written app work locally. found app, pgadmin3, lets me sorts of admin tasks gui. good. every time restart computer, once due kernel panic usb firewire audio interface, once power failure, , 2 user initiated restarts - each time after reboot, database empty. database users/roles still there, tables , relations there, however, tables empty. 0 records. nothing. pgadmin3 shows table has space allocated number of millions of records, "undefined" count. refreshing count, reveals 0 records. browsing data reveals 0 records. mac application (using libpq) connects database successfully, , gets 0 results any/all of select statements. redundant mention each re-import of database takes 15 hours? (rhetorical question) any , suggestions appreciated. mac os x 10.0.2 (yose

python - Error Migrating Comment Framework Into Django -

i trying use django's built-in comment framework project working on. according django documentation first 2 steps are: install comments framework adding 'django.contrib.comments' installed_apps run python manage.py migrate django create comments tables. so did , got following error comments.comment.site: (fields.e300) field defines relation model 'site', either not installed, or abstract. i don't know went wrong because did add 1 line installed_apps , ran migrate . appreciated. try adding django.contrib.sites in installed_apps , set site_id=1 in settings.py . it's shown error: field defines relation model 'site', either not installed, or abstract. and migration file source code : dependencies = [ ('sites', '0001_initial'), migrations.swappable_dependency(settings.auth_user_model), ('contenttypes', '0001_initial'), ] it suggested django.contrib.sites indeed dependency a

Install additional version of WebStorm on same Mac machine -

few years ago did buy webstorm version 6. day ago renew license , webstrom version 10. question can install new webstorm( v.10 ) on same mac machine (v.6 ) ? , don't break previous v.6 installation. , use both version different projects. thanks, herclia i have done intellij renaming existing app. also when attempt move new 1 applications folder prompt "webstorm exists in location." options keep both, stop or replace. if choose keep both new 1 have "copy" appended name. a possible problem though when open project in newer version might upgraded. not sure if able open in older version.

Swift: Calling a segue from a different view controller delegate -

i have viewcontroller, call popover, in popover have delegate calls function in main viewcontroller. in function close popover , want load different view controller, the closing of original popover works, if this func keypaddismissdata(view: uiviewcontroller, password : string){ view.dismissviewcontrolleranimated(true, completion: nil) } however if try , call segue load new view controller code func keypaddismissdata(view: uiviewcontroller, password : string){ view.dismissviewcontrolleranimated(true, completion: nil) self.performseguewithidentifier("logintomain", sender:nil) } i error warning: attempt present <uiviewcontroller: 0x7fc768488900> on ... view not in window hierarchy! any ideas how can round this? thanks not sure if problem, can try: you open popover in mainviewcontroller. dismiss popover use delegate, dismissing popover in mainviewcontroller. right after popover dismissed, want segue view. i recreated , co

search - Searching an array with monotonic sequences of values -

i have large array values go monotonically , down (no ties) in long sub-sequences (such sequences can number , of arbitrarily large size, , of course > 2 terms). example in small scale: 1 2 3 4 5 9 7 4 3 -2 -5 -7 3 5 34 56 67 78 89 90 8 6 2 -4 -5 ... and on. i interested in finding any (just 1 , not all) of values ending increasing sequence , right new decreasing sequence starts. what best way , complexity ? (my intuitive idea done binary search, guessing o(logn), not sure if might right) you cant apply binary search here because given sequence not sorted. can in o(n) searching first element next element less element. in above example 9 answer

numpy - Need explanation about results produced from Python's sci-kit template matching library -

edit: template url: http://c.nordstromimage.com/assets/idev/common/00-00-00-free-shipping-evergreen-cid0330153898-7-adam-a4c331d8-38ab-4337-baf9-a46801899b3e-fil-file.png?version=1 image url: http://shop.nordstrom.com/ i read through sample tutorial here on template matching. template matching technique used identify/locate small patch image (aka "template") within larger image. , here easy-to-read documentation explaining input/outputs using template_matching library in python. now here question. output of template_matching library supposed numpy array consisting of correlation coefficient values. these coefficients supposed values between -1.0 , 1.0 have values > 1.0 in output array. below code using (it's same 1 provided in tutorial): def template_match(self): #self.main_image screenshot of [this](http://shop.nordstrom.com/) webpage taken in selenium #self.template [this](http://c.nordstromimage.com/assets/idev/common/00-00-00-free-shipping-

javascript - data-binding not working on nested ng-repeat -

when nesting ng-repeat seems clicking on toggle button updates addon in every 'pair' (the first ng-repeat). can explain me why case , can fix it? check link above custom directive code... <div ng-repeat="pair in pairs track $index"> <h3>pair {{ $index + 1}}</h3> <div class='fieldrow'> <button ng-repeat="addon in addons track $index" toggle-button="addon.added">{{addon.name}} (£{{addon.price}})</button> </div> </div> what pair , addon, , how related. right now, though have nested ng-repeat, have independent data structures, addons array same each pair. trott. based on insight, changed ng-repeat="addon in addons track $index" ng-repeat="addon in pair.addons track $index" problem solved, thanks!

c++ - What is the fastest way to display a byte array using imshow in opencv? -

i have pointer image buffer (byte array) , know number of rows , columns. fastest way of displaying image data in opencv. see details below. int rows, cols; unsigned char *imagebuffer; if (err = wfs_getspotfieldimage(instr.handle, &imagebuffer, &rows, &cols)) handle_errors(err); // goes here construct "mat image" using "imagebuffer" pointer? mat image(rows, cols, cv_8uc3, scalar(255, 0, 0)); cv::namedwindow("spot field", cv::window_autosize); cv::imshow("spot field", image); use constructor: mat::mat(int rows, int cols, int type, void* data, size_t step=auto_step) data – pointer user data. matrix constructors take data , step parameters not allocate matrix data. instead, initialize matrix header points specified data, means no data copied. operation efficient , can used process external data using opencv functions. external data not automatically deallocated, should take care of it.

Is there any multiline commenting support for C/C++ languages in Atom Editor? -

i'd enable multi line commenting support in atom editor. i'd editor automatically add * , proper indentation @ beginning of new lines of multiline comment. here's sample of i'm looking for: /*** * comment * when i'm adding new line automatically adds " * ". */ i've tried such package in atom package search, on , google failed find anything. must have typed wrong key words. know geany editor has such feature guess atom has 1 well. so, didn't know keyswords should block comment . i managed find excellent extension described a helper package writting documentation . one way or looking for. here link repo: https://github.com/nikhilkalige/docblockr

constructor - C++ unexpected syntax errors -

ok have updated code: #ifndef vector_h #define vector_h #include<cstdlib> #include<vector> #include<iostream> using namespace std; template < typename t> class myclass { public: myclass() : size(10), index(0) { vec = new t[10]; }; myclass(int i) : size(i), index(0) { vec = new t[i]; }; friend bool add(t i); virtual ~myclass(); friend ostream& operator<<(ostream& out, const t& obj); private: t * vec; int size; int index; }; template <typename t> virtual myclass<t>::~myclass() { delete[] vec; } template <typename t> ostream& operator<<(ostream& out, const myclass<t>& obj){ (int = 0; < index; ++i) out << obj[i] << " "; out << endl; } template <typename t> bool myclass<t>::add(t i){ if (size == index){ size *= 2; realloc(vec, size); } vec[index++] = i; } #endif // !vector_h err

database - store multiple radio groups status android -

i working on app have multiple radio groups. want save checked status , restore on next restart. so efficient way that? i think need use sharedpreferences store checked items in radio groups because present unless uninstall app. to store value's in shared preferences list<radiogroup> radiogroups; list<string> savedids; sharedpreferences preferences = preferencemanager.getdefaultsharedpreferences(this); sharedpreferences.editor editor = preferences.edit(); editor.putstring("number of radio groups", radiogroupscount); for(int i=0; i< radiogroupscount; i++){ editor.putstring("radiogroup"+string.valueof(i), radiobuttongroup.getcheckedradiobuttonid();); } editor.commit();(); to retrieve values shared preferences: sharedpreferences preferences = preferencemanager.getdefaultsharedpreferences(this); string count = preferences.getstring("number of radio groups", 0); if(count >=0){ for(int i=0; < count; i++){ sav

opencl - cl_khr_gl_sharing is supported for Pentium G860 but not for Core i7-4960X -

i have 2 computers, 1 gtx 980 + intel core i7 4960x , other 1 has amd radeon hd 7850 + pentium g860. getting device features opencl's clgetdeviceinfo function. wondering why penitum g860 supporting cl_khr_gl_sharing extension , core i7-4960x not supporting in opencl. is related difference between amd , nvidia graphic cards? or difference between cpus? because definitely, core i7-4960 much more powerful pentium g860. intel opencl drivers installed on both computers. nvidia system, using nvidia opencl 1.1 driver amd one, using amd app sdk 3.0. can difference due that?

php - Smarty error: modifier 'unescape' is not implemented -

i want smarty show html variable content part of html file, use "unescape" modifier show here : <div id="add">{if $add}{$add|unescape:"html"}{/if}</div> but get: fatal error: smarty error: [in xxx.html line 20]: [plugin] modifier 'unescape' not implemented (core.load_plugins.php, line 118) in xxx/inc/lib/smarty/smarty.class.php on line 1095 my plugin directory in correct place: smarty$ ls config_file.class.php smarty.class.php smarty_compiler.class.php debug.tpl error_log internals plugins what can wrong , how can want? try dealing via php: <div id="add"> {if $add} {php} echo html_entity_decode($add); {/php} {/if} </div> you can play arround htm_entity_decode function fit needs, or can use htmlspecialchars_decode() or mb_convert_encoding() smarty unascape function suggests.

valgrind - Issues with memcheck in C calculator -

i'm writing calculator in c scratch (homework assignment) , have troubles memory somewhere.. algorithm works perfectly, i'm getting set of valgrind errors/warnings, e.g.: echo -n "1" | valgrind ./a.out --track-origins=yes ==14261== conditional jump or move depends on uninitialised value(s) ==14261== @ 0x400b9f: create_rpn (main.c:53) ==14261== 0x400742: main (main.c:253) my makefile: all: gcc main.c -g -o2 -wall -werror -std=c99 my source code below (and on github) . can it? thank in advance! #include <stdio.h> #include <stdlib.h> #include <string.h> #define max_len 1024 // needs check priority int get_power(char op) { if (op == '+') { return 2; } else if (op == '-') { return 2; } else if (op == '*') { return 4; } else if (op == '/') { return 4; } else { return 0; } } // checks if current char operator int is_operator(ch