Posts

Showing posts from February, 2011

ruby on rails - Check if method defined on mixee class? -

we have module handle canceling models. it's clean, works nice, we've run in issue class want mix in has our module methods ( cancel! , etc) defined. we tried come new names avoid collisions, seems less-than-ideal, , cleanness of calling cancel! . so, we've decided want like: def cancel! cancelly_stuff if class.parent.respond_to(:cancel!) super end however, it's module, class we're mixing in not class.parent . unable google how reference mixee-class of module. i come answer post, using prepend instead of include (only ruby 2.x). first including @ top of ancestry chain, since second goes after class. let see how works @ irb console: ~/rails/learn/ruby (main) > module ~/rails/learn/ruby (main) | def cancel! ~/rails/learn/ruby (main) | puts 'cancel m:a' ~/rails/learn/ruby (main) | super if defined? super ~/rails/learn/ruby (main) | end ~/rails/learn/ruby (main) | end => :cancel! ~/rails/learn/ruby (main) > c

javascript - jQuery callback once everything in the DOM is loaded, and after the first, initial load -

a page loads, scripts, css, basic dom, finished. a user something, , function loads several elements dom. video s, div s background images, img s. takes while. they append() ed html code, nothing fancy, , browser of course starts of requests respective resources. i want callback event once of basic http requests finished. like window.onload = function() { .. } or $(window).load(function() { .. }); but neither of seem work. i'm dealing multiple types of elements, basic like $('img').on('load',function() { .. }); would not work. ideas?

ios - How to change instantly a button to an activity indicator in xcode 6 -

i'm trying change button in navigation bar activity indicator instantly when pressed. tryed code, button change when ibaction process end: - (bool)connected { reachability *reachability = [reachability reachabilityforinternetconnection]; networkstatus networkstatus = [reachability currentreachabilitystatus]; return networkstatus != notreachable; } - (ibaction)scaricadatabase:(id)sender { if (![self connected]) { _navtitle.leftbarbuttonitem = [[uibarbuttonitem alloc] initwithtitle:@"non connesso" style:uibarbuttonitemstyleplain target:nil action:nil]; } else { uiactivityindicatorview *activityindicator = [[uiactivityindicatorview alloc] initwithframe:cgrectmake(0, 0, 20, 20)]; uibarbuttonitem * barbutton = [[uibarbuttonitem alloc] initwithcustomview:activityindicator]; activityindicator.color = [uicolor blackcolor]; // set left or right [activityindicator startanimating]; [[self navtitle] setleftbarbuttonitem:barbutton]; nsstring *d

shell - How do I notify a user if a pen drive is connected in a bash script? -

i writing interactive script copy files pen drive hard drive , vice versa. (i have written script take care of this). stuck @ part, how notify user if pen drive connected/disconnected in bash script? after detection of usb drive leave user run script further or not. tried "udevadm monitor" throws device specific events. seems need find way build on it.

c# - How do I enable umbracoNaviHide in Umbraco 7 -

Image
i new umbraco , trying hide page nav bar. based on have read need change value of property umbraconavihide . nothing have read gives specific information on how or property located. having hard time finding detailed information umbraco 7. is need enable in xslt file somewhere shows editable property in umbraco ui or need add code somewhere , rebuild umbraco? is property need include in template files somewhere? any appreciated. go to: http://www.systenics.com/blog/create-a-responsive,-fluid-html5css3-based-website-on-umbraco-7-using-bootstrap-30-framework/?tag=umbraco+7 , umbraconavihide on page , see how set property. relevant text link: switch generic properties tab , click on click here add new property link... generic properties tab can found going settings->documenttype->[name of document type] , click on generic properties on right side. and follow instructions provided in following image: this post might helpful understand how umbrac

ios - SpriteKit SKSpriteNode filles entire scene -

i'm trying add skspritendoe scene reason image fills entire scene if image size 50x50 pixels. here's code: let sprite = skspritenode(imagenamed:"my-sprite") sprite.position = cgpoint(x: cgrectgetmidx(self.frame), y: cgrectgetmidy(self.frame)) addchild(sprite) thanks

java - Get fully-qualified class name from jclass (JNI) for use in FindClass -

let's assume hav instance of jclass: auto objectclass = env->getobjectclass(obj); exception_return(env); on next line, want name of class , store can use findclass later on. i've tried using getname() method returns java class name , can't use in findclass . here code getname() approach: std::string getobjectclassname(jnienv* env, jobject javaobject) { auto javaclass = env->getobjectclass(javaobject); exception_return(env); auto javaclassclass = env->findclass("java/lang/class"); exception_return(env); auto javaclassnamemethod = env->getmethodid(javaclassclass, "getname", "()ljava/lang/string;"); exception_return(env); auto javaclassnamejstring = (jstring)env->callobjectmethod(javaclass, javaclassnamemethod); exception_return(env); auto javaclassnamec = env->getstringutfchars(javaclassnamejstring, 0); exception_return(env); std::string javaclassname(javaclassnamec)

xml parsing - Read XML Webfile in C# Windows Form and place data in labels -

for information program need read web xml file , place in label every value. an example of xml file: <actuelevertrektijden> <vertrekkendetrein> <ritnummer>5070</ritnummer> <vertrektijd>2015-03-20t19:42:00+0100</vertrektijd> <eindbestemming>den haag centraal</eindbestemming> <treinsoort>sprinter</treinsoort> <routetekst>lage zwaluwe, dordrecht, rotterdam c.</routetekst> <vervoerder>ns</vervoerder> <vertrekspoor wijziging="false">6</vertrekspoor> </vertrekkendetrein> <vertrekkendetrein> <ritnummer>1971</ritnummer> <vertrektijd>2015-03-20t19:50:00+0100</vertrektijd> <eindbestemming>venlo</eindbestemming> <treinsoort>intercity</treinsoort> <routetekst>tilburg, eindhoven, helmond</routetekst>

Python LinkedIn Search API 403 error -

i trying public profiles of people work in company x title, id, , connection. how use search api not 403 forbidden error? from linkedin import linkedin consumer_key = 'xxx' consumer_secret = 'xxx' user_token = 'xxx' user_secret = 'xxx' return_url = '' auth = linkedin.linkedindeveloperauthentication(consumer_key, consumer_secret, user_token, user_secret, return_url, permissions=linkedin.permissions.enums.values()) app = linkedin.linkedinapplication(auth) mm=app.search_profile(selectors=[{'people': ['headline','id','num-connections',]}], params={'keywords': 'microsoft'}) print mm so code gives me error message file name line position traceback <module> <module1> 30 search_profile c:\python27\lib\site-packages\linkedin\linkedin.py 194

php - mysqld.exe huge memory usage (450 MB) immediately after start WAMP -

i'm using same wamp version several months , never saw mysqld.exe @ top of memory usage task manager list. (it's stuck on 442 664 k). problem started today. i didn't touch my.ini ever. all did today changing php.ini, (adding xdebug stuff) turn changes , memory usage stuck on 442 mb. my.ini (part of) # mysql server [wampmysqld] port = 3306 socket = /tmp/mysql.sock key_buffer_size = 16m max_allowed_packet = 1m sort_buffer_size = 512k net_buffer_length = 8k read_buffer_size = 256k read_rnd_buffer_size = 512k myisam_sort_buffer_size = 8m [mysqldump] quick max_allowed_packet = 16m [isamchk] key_buffer = 20m sort_buffer_size = 20m read_buffer = 2m write_buffer = 2m [myisamchk] key_buffer = 20m sort_buffer_size = 20m read_buffer = 2m write_buffer = 2m php.ini (part made changes today , parts resources limits , memory mentions) ;;;;;;;;;;;;;;;;;;; ; resource limits ; ;;;;;;;;;;;;;;;;;;; max_execution_time = 800 max_input_time = 600 max_input_var

java - Making android application using pubnub to send GPS information but app crashes and shows no errors -

i making application sends realtime messages through pubnub server users subscribed same channel. have working can send strings device device, want send gps information. user input string "gps" , trigger method send location info instead of string. having trouble part because no errors shown, app crashes when try open it. tried debugging, can figure out whats going wrong. debugger takes me out of activity , these other java class files embedded in java after step on oncreate method. or feedback appreciated, thanks! some errors found in logcat: adb: ddms: null java.nio.bufferoverflowexception @ java.nio.heapbytebuffer.put(heapbytebuffer.java:182) @ com.android.ddmlib.jdwppacket.movepacket(jdwppacket.java:235) @ com.android.ddmlib.debugger.sendandconsume(debugger.java:347) @ com.android.ddmlib.client.forwardpackettodebugger(client.java:698) @ com.android.ddmlib.monitorthread.processclientactivity(monitorthread.java:34

sorting - Strange DataWindow sort with negative numeric string -

i have sortable datawindow in powerbuilder (both 9 , 12.6) giving me collywobbles. have field called category, defined char(4). form populates field restricts 4 numeric characters. smartass tester me saw , went "hmm, doesn't disallow negatives, it?" , checked. didn't. tried sorting field. if query in oracle, sorts predicted, -001 @ top. if take datawindow, though, starts out sorted obj_no, , tell sort category instead, sorts in following order: ... 0009 -001 0010 ... i'm having darnedest time coming reason ever make sense. else? eta: @avk, looks kind of this. if ls_sort_cols[i] <> '-' ls_sort_str = ls_sort_str+' '+ls_sort_cols[i]+' a' if len(ls_sort_str) > 0 ldw_win.setsort(ls_sort_str) ldw_win.sort() end if i've confirmed value of ls_sort_str going setsort line "category a". it's better code this: if len(ls_sort_cols) > 0 ldw_win.reset() ldw_win.importstring( ls_sort_co

php - Yii2: sum of a column on filtered values in Gridview -

i can sum column in gridview using below code: <?php $command = yii::$app->db->createcommand("select sum(net_total) estimate"); $sum = $command->queryscalar(); echo 'total ='. $sum; ?> i have column in db discharge_date (which date & time field) , want change sum on filter on column. if filtered data show 5 records, want sum 5 records. thanks. updates per answer the code this: $query = app\models\estimate::find(); $dataprovider = new activedataprovider([ 'query' => $query, ]); $ids = []; foreach($dataprovider $i => $model) { $ids[] = $model->id;} $command = yii::$app->db->createcommand("select sum(net_total) estimate `id` in ('.implode(',',$ids).')"); // please use prepared statement instead, proof of concept $sum = $command->queryscalar(); echo $sum; now getting error on line $ids[] = $model->id;} getting unknown property: yii\db\activequery::id

python - How to use CFB mode of AES in pycrypto -

my question how use cfb mode in pycrypto? problem module doesn't accept arbitrary length of iv , key. >>> crypto.cipher import aes >>> aes = aes.new('123456', aes.mode_cfb, '12345678') traceback (most recent call last): file "<stdin>", line 1, in <module> file "/usr/lib/python2.7/dist-packages/crypto/cipher/aes.py", line 94, in new return aescipher(key, *args, **kwargs) file "/usr/lib/python2.7/dist-packages/crypto/cipher/aes.py", line 59, in __init__ blockalgo.blockalgo.__init__(self, _aes, key, *args, **kwargs) file "/usr/lib/python2.7/dist-packages/crypto/cipher/blockalgo.py", line 141, in __init__ self._cipher = factory.new(key, *args, **kwargs) valueerror: iv must 16 bytes long next: >>> aes = aes.new('123456', aes.mode_cfb, '1234567890abcdef') traceback (most recent call last): file "<stdin>", line 1, in <module&g

java - StyleManager not applying CSS properly -

Image
i'm encountering issue stylemanager in java 1.8.0_25. if apply css file scene directly css appear properly. however, if try , use stylemanager apply css file across scenes, css not applied. here's simple program demonstrate issue public class test extends application { public static void main(string[] args) { launch(args); } @override public void start(stage primarystage) throws exception { application.setuseragentstylesheet(null); parent node = new fxmlloader(getclass().getresource("testing.fxml")).load(); scene scene = new scene(node); // stylemanager.getinstance().adduseragentstylesheet("tabpanetest.css"); scene.getstylesheets().add("tabpanetest.css"); primarystage.setscene(scene); primarystage.show(); } } testing.fxml: <?xml version="1.0" encoding="utf-8"?> <?import java.net.*?> <?import java.lang.*?> <?impor

vb.net - How to check if a folder exists automatically without ".click" function -

i have problem. have program written in visual basic using visual studio 2013 , works good. problem want program check if folder exists on program start-up , return text value in label without having manually "click" label. have searched , cannot find anything, maybe i'm not searching right thing? here sample of check: ''//asdg_jr check private sub lbl_asdg_jr_pres_click(sender object, e eventargs) handles lbl_asdg_jr_pres.click if my.computer.filesystem.directoryexists(user_txt_dir.text & "\@asdg_jr_v0.14") lbl_asdg_jr_pres.text = "all good!" btn_asdg_di.text = ".zip file downloaded already" btn_asdg_unzip.text = "unzipped , installed already" btn_asdg_di.enabled = false btn_asdg_unzip.enabled = false else lbl_asdg_jr_pres.text = "use buttons ----->" btn_asdg_di.enabled = true btn_asdg_unzip.enabled = true end if end sub

Unable to get Tomcat Security constraints working for conf\web.xml -

i have tomcat webapp deployed using security constraints @ web-inf level (webapps\app1\web-inf\web.xml). works on well: <security-constraint> <web-resource-collection> <web-resource-name>app1</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>confidential</transport-guarantee> </user-data-constraint> </security-constraint> it directs users https if try go through http. issue can not work @ conf level. (conf/web.xml) why wouldn't work @ level if works fine in webapps?

python - Finding best curve fit with AIC -

i have quite sophisticated problem(for me). have write code calculate interpolation given data set.after calculate akaike information criterium check interpolation suite best. looks that: polyfit=np.polyfit(x,y,5) # x,y data set , 5 root of polynomial poly1d=np.poly1d(polyfit) print poly1d #show final polynomial my=[] in x: x_=poly1d(i) my.append(x_) #calculate list of values def aic(i,j): in y: j in my: rss=(i-j)**2 aic=36-np.log(rss) print aic and don't code becouse if want change root of polynomial have change code. know have use loop in begining like: for in xrange(40): polyfit=np.polyfit(x,y,i) but can't figure out how save of polynomials list.if knew use calculate def aic() root,and find best curve fit data. please guys,its bothering me 2 weeks already.if there not clear you,please ask.

Xcode offers strange solution for explicitly dead code in c++? -

i'm writing program supposed solve sudoko-like puzzle, hashiwokakero. have code looks this: if (bridgesleft[row][col] == 1) { dosomething(); } else if (bridgesleft[row][col] == 2) { dosomethingelse(); } else if (bridgesleft[row][col] == 3) { doanotherthing(); } ... i realized put bug in dosomethingelse() function, rather deleting block, added else if (bridgesleft[row][col] == 2 && false) guarantee buggy function wouldn't run, make sure bug coming from. xcode gave me warning, saying dosomethingelse() code never run. gave me option: fix-it: silence adding parentheses mark code explicitly dead. clicking on button changes else if (bridgesleft[row][col] == 2 && false) to else if (bridgesleft[row][col] == /* disables code */ (2) && false) how parentheses around '2' mark code explicitly dead? mean? if leave parentheses in, take && false part out, code block still executed, it's not making code dead.

Internet Explorer 11 resets PHP session on 5th tab -

ok 1 of odder issues have run into. we have company intranet site. many of our employees need open several of our intranet php pages @ same time, sharing php session variables (branch, etc.) between of pages. complaining losing sessions , able determine that, regardless of page opened, whenever opened 5th tab, if page has session_start() function reset session of open pages. of old session variables killed , ones available ones created on page. this happens on internet explorer 11 far can tell. have few machines still on 10 , can open more 5 tabs without issue. although might have different settings well, haven't looked of yet. i love use different browser firefox or chrome need use internet explorer variety of things. anyone have idea do? tried looking around , found information on tab processes , such looks might right fix, bit confusing.

Using a PHP while loop causes my CSS footer to disappear -

i have php while loop data mysql database , repeat <div> s per data. when data retrieved, issue footer disappears, because background image becomes unlimited. below css code background , footer. .wrapper { background: url(../images/bg.png) #eee; border-bottom: 1px solid #bbb; -webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.1); -moz-box-shadow: 0 1px 2px rgba(0,0,0,0.1); box-shadow: 0 1px 2px rgba(0,0,0,0.1); padding: 30px 0; .footer { color: #999; padding: 40px 0px 0px 15px; } it's difficult understand question when not post of code. or complete code snippets. check out background-repeat read more this

python - Splitting numpy arrays based on categorical variable -

i'm trying split ages , weights based on categorical variable "obese" , plot 2 sets different colors. think might doing list comprehension wrong. when plot see 1 color , data points. import numpy np import matplotlib.pyplot plt ages = np.array([20, 22, 23, 25, 27]) weights = np.array([140, 144, 150, 156, 160]) obese = np.array([0, 0, 0, 1, 1]) ages_normal = [ages in range(0, len(obese)) if obese[i] == 0] weights_normal = [weights in range(0, len(obese)) if obese[i] == 0] ages_obese = [ages in range(0, len(obese)) if obese[i] == 1] weights_obese = [weights in range(0, len(obese)) if obese[i] == 1] plt.scatter(ages_normal, weights_normal, color = "b") plt.scatter(ages_obese, weights_obese, color = "r") plt.show() i'd like: import numpy np import matplotlib.pyplot plt ages = np.array([20, 22, 23, 25, 27]) weights = np.array([140, 144, 150, 156, 160]) obese = np.array([0, 0, 0, 1, 1]) data = zip(ages, weights, obese) data_normal

iis 7 - Anonymous and Forms Authentication IIS 7 -

first of, sorry not posting actual code, want pointed in direction. might post code later if needed. so, have 3 applications running in iis 1 - application 2 - authentication , access management 3 - ntlm all use application pool framework 2.0 classic mode. 1 , 2 uses annonymous , form authentication, 3 uses windows authentication. the flow is, when access 1 or 2, redirects ntlm auth , returns authentication. if access first 1 good, goes ntlm , if dont have valid windows account returns app login page. when try access second 1 redirect loop ntlm login page ntlm , on... both have same configuration. i know might not explicit, going insane on , don't more look. weird may sound, when setting machinekey on web.config, put decryption="auto", totally normal... because it's same setting in iis console. causing error in event viewer saying invalid ticket. still can't figure out why... anyway if come across same weird issue, here have have

Fingerprint minutiae Matching using artificial neural network (back propagation) in matlab -

Image
i have done fingerprint minutiae extraction this: and ideally need neural network in matlab can classify 10 groups of fingerprints using extracted minutiae images pattern matching. i have 3 fingerprint images each group going train network 2 images , test 1 image per group. would guys suggest me building model myself like: http://uk.mathworks.com/help/nnet/gs/classify-patterns-with-a-neural-network.html or paste code may use? have tried code online of them cannot hoping them be.

what binary standards are there for sharing code in linux (similar to COM)? -

so have finished reading article here: https://msdn.microsoft.com/en-us/library/ms809983.aspx about why have com , how lets share code without worrying name mangling of compilers or unicode/ascii issues or memory management in language independent manner. i have elsewhere read com isn't supposed linux because com uses os moderator acquisition of these standardized objects. shouldn't there similar in linux? , if so, it? on linux can run program accepts input on standard input, , connect it, via pipe, other program generates results on standard output. the simple, file , pipe-based input/output in posix predates ms-windows decades. and, long both sides of pipe agree on format of data being interchanged, doesn't matter compiler used create each program (although, on linux, there's pretty 1 de-factor compiler, it's moot point). and using socket-pair, pipe becomes bi-directional, both processes can swap data each other. this is, generally, how p

c++ - Checking if SSE is supported at runtime -

this question has answer here: how check if cpu supports sse3 instruction set? 3 answers cpu dispatcher visual studio avx , sse 3 answers i check if sse4 or avx supported @ runtime, program may take advantage of processor specific instructions without creating binary each processor. if determine @ runtime, use interface , switch between different instruction sets. gcc has way of doing starts calling __builtin_cpu_init calling __builtin_cpu_is , __builtin_cpu_supports check features. https://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/x86-built-in-functions.html on x86, when using c++ frontend, gcc supports "function multiversioning", allows write multiple versions of function, specify target should used on, , let gcc take care of making sure called. https://g

linux - filter text file rows by certain column without quotation marks -

so have file i'd rows from, unfortunately strings within rows aren't surrounded quotation marks. how can filter these rows based on 2nd column value?? eg have: string a,string b,string c,string d,string e string 1,string 2,string 3,string 4,string 5 string f,string b,string h,string i,string j string 6,string 7,string 8,string 9,string 0 and want in new file only: string a,string b,string c,string d,string e string f,string b,string h,string i,string j i'm trying use command: awk -f '","' 'begin {ofs=","} { if (toupper($2) == "string b") print }' input.csv > output.csv you don't need include double quotes on setting fs value. $ awk -f, 'begin {ofs=","} { if (toupper($2) == "string b") print }' file string a,string b,string c,string d,string e string f,string b,string h,string i,string j

javascript - getting an error there is no attribute "placeholder" in xhtml strict 1.0 -

i realize placeholder html 5 believe. there alternative placeholder? i have use xhtml strict 1.0 it's requirement. xhtml support placeholder because xhtml mix of xml & html. function works won't validate because validation methods haven't caught new coding principles. use alternative validate; <input type="text" onfocus="if (this.value==this.defaultvalue) this.value = ''" onblur="if (this.value=='') this.value = this.defaultvalue" value="your placeholder text here" />

javascript - angularjs expression didn't execute properly -

my html {{myid}} <iframe width="100%" height="325" src="http://example.com/direct/?param={{myid}}" frameborder="0" allowfullscreen></iframe> the first {{myid}} worked second didn't. when check dom it's still {{myid}}, why? please try ng-src instead src: <iframe width="100%" height="325" ng-src="http://example.com/direct/?param={{myid}}" frameborder="0" allowfullscreen></iframe>

javascript - Why does the id of the datalist option return empty value? -

i've been stuck on datalist hours , can't figure out why returns empty when alerting selected object (4000 islands, laos example). want return 'id' attribute of selected option in list. jquery: $k2 = jquery.noconflict(); $k2('#submit').on('click',function(){ var g=$k2('#to-selected').val(); var id = $k2('#to').find('option').attr('id'); alert(id); return false; }); html: <td> <input autofocus="" type="text" list="to" id="to-selected" style="width: 145px;"> <datalist id="to"> <option id="" value="all"></option> <option value="4000 islands, laos" id="4483"></option> </datalist> </td> <button id="submit">test</button> i have feeling has 'all' option after removal works fine. appreciated! jsfiddle can found here. http://jsfi

c# - ShowDialogue not generating DialogueResult.OK -

i'm writing program that's supposed download off github. has link raw file on github. i'm using downloaddataasync download it, , have progress bar track how far in download. gets 100%, nothing. i've been following tutorial c# updater bettercoder (the beginning starts here , relevant part part 9 of series). this part stops working properly: private void downloadupdate(saveyourupdatexml update) { sharpupdatedownloadform form = new sharpupdatedownloadform(update.uri, update.md5, this.applicationinfo.applicationicon); debug.writeline("form created"); dialogresult result = form.showdialog(this.applicationinfo.context); debug.writeline("got result"); if (result == dialogresult.ok) { string currentpath = this.applicationinfo.applicationassembly.location; string newpath = path.getdirectoryname(currentpath) + "\\" + update.filename; updateapplication(form.tempfilepath, currentpath, newpat

osx - Error when trying to compile C program code in C99 mode -

when i'm compiling simple program 'hello world', i'm getting warning @ printf function. here error message: hey.c:4:5: warning: implicit declaration of function 'puts' invalid in c99 [-wimplicit-function-declaration] puts("hello world!"); ^ 1 warning generated. ld: can't write output file: a.out architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation) yes need include stdio.h in code . compilers allow use printf without header file generate warning

javascript - Labels inside canvas pie charts -

i making pie chart canvas unable put labels canvas. tried many things... can me? html <canvas id="can" width="200" height="200" /> js var d1 = 15; var d2 = 15; var d3 = 45; var d4 = 25; var canvas = document.getelementbyid("can"); var ctx = canvas.getcontext("2d"); var lastend = 0; var data = [d1,d2,d3,d4]; // if add more data values make sure add more colors var mytotal = 0; // automatically calculated don't touch var mycolor = ["#ecd078","#d95b43","#c02942","#542437"]; var labels = ["25%","25%","25%","25%"]; (var e = 0; e < data.length; e++) { mytotal += data[e]; ctx.font = 'bold 15pt calibri'; ctx.filltext(labels[e],15,15); } (var = 0; < data.length; i++) { ctx.fillstyle = mycolor[i]; ctx.beginpath(); ctx.moveto(canvas.width / 2, canvas.height / 2); // arc parameters: x, y, radius, startingangle (radian

meteor - Category URL incorrect in Telescope -

the category url in telescope should eg: www.domainname.com/category/sports instead in app showing www.domainname.com/domainname.comcategory/sports not sure config file or root url incorrect or else. here env config // configure environment "env": { "root_url": "http://bollymojo.com", "mongo_url": "mongodb://admin:affable14@c944.candidate.16.mongolayer.com:10944,c922.candidate.35.mongolayer.com:10922/bollymojo?replicaset=set-550b97a8fa82e80ceb000438" }, could guys please help, thanks! there's siteurl setting in settings panel overrides root_url . maybe that's 1 need set?

sql - Finding Rows based on a set of same columns in ORACLE -

consider following table:- ----------------------------------------- id teacher subject grade ----------------------------------------- 1 jack physics 8 2 paul chemistry 10 3 susan english 6 4 jack maths 8 5 jack physics 10 6 paul chemistry 10 i want identify rows same values teacher , subject columns. irrespective of values in id , grade columns. following rows identified:- ------------------------------------- id teacher subject grade ------------------------------------- 1 jack physics 8 2 paul chemistry 10 5 jack physics 10 6 paul chemistry 10 ------------------------------------- how achieve such result in oracle sql. select * table1 t1 exists ( select null table1 t2 t1."teacher" = t2."teacher" , t1."subject&qu

SQL server: To create a table inside a schema -

i wish create table t1. , when execute query table should include in humanresources schema exists in database. how should change query this? table t1 humanresources schema? create table t1 ( id int, name varchar(20) ) create table humanresources.t1 (...); in attempt, trying add database called humanresources , schema dbo . it's database.schema.object. edit in response op's comment, question has been answered here: how create sql table under different schema?

material design - Ripple requires API level 21 (current min is 11), android? -

i have below drawable <?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?android:colorcontrolhighlight" > <item> <shape android:shape="oval" > <solid android:color="?android:coloraccent" /> </shape> </item> and getting error <ripple> requires api level 21 (current min 11) how solve it? you using minsdk=11. you can't use drawable api<21. you have use diffent versions of drawable file. put code in res/drawable-v21/myripple.xml , create different res/drawable/myripple.xml

c - open a man page in linux terminal -

how open man page of mkdir terminal . want manual entry given in following link . simply give this. man 2 mkdir from man page of man 1 executable programs or shell commands 2 system calls (functions provided kernel) 3 library calls (functions within program libraries) 4 special files (usually found in /dev) 5 file formats , conventions eg /etc/passwd 6 games 7 miscellaneous (including macro packages , conventions), e.g. man(7), groff(7) 8 system administration commands (usually root) 9 kernel routines [non standard] you need open system call , have mention 2. if give this, man mkdir open man page of mkdir command.

How can we emulate variadic templates in Haskell? -

in c++ can define function takes variable number of statically typed arguments, using variadic templates , so: template<typename... params> void f(params... parameters); (alternatively have create struct variadic number of fields , used argument f .) we can use type traits inspect values. similar in haskell. i'd define data type , family of functions parameterized number of statically typed arguments: data t ??? = ... mkt :: ... -> t ??? f :: t ??? -> ... f needs able convert parameter types values can generic them (think printf). perhaps job hlists?

logging - Simple c++ program gets compilation errors -

when i'm trying compile code, shows error: main.cpp:19:3: error: invalid operands of types 'void' , 'int' binary 'operator!=' this file: #include <iostream> #include <cstdio> using namespace std; #define $ debug #define debug 1 #define _(out) do{ std::cout << __file__ << ":" << __line__ \ << " " << out << '\n';}while(0) #define _(out) printf(out); int main(){ #ifdef local_project #define debug 0 #endif $ && ({ _("eeeeewe"); });//line 19 return 0; } $ simple name of debug , in runtime it's 0 or 1 . the compilation error source file. how rid of , compile? there things you're doing here inadvisable, , illegal. gave upvote @ least alerting me gcc extension hadn't seen : #include <iostream> int main() { int x = ({std::cout << "i'm surprised prints ";

php - How to send Data form view to controller through URL in codeigniter and how i get data in controller -

how send data form view controller through url in codeigniter , how data in controller? <div class="col-md-3 col-md-3-text"> <div class="classwithpad"><img src="<?php echo base_url(); echo 'assets/img/'; echo $title[$i]->image; ?>"/> <?php $id = $title[$i]->category_id; ?> <div class="title_banner"><a href="<?php echo site_url('welcome/category','' ) ?>" class="mhover"><?php echo $title[$i]->category_name; ?></a></div> </div> </div> send this you have use $_get[] method of php: <a href="<?php echo base_url()?>your_controller/your_function?id=1">my data</a> this redirect controller had function , within your_function have use $_get['id'] function your_function() { $id = $this->input->get('id'); }

osx - How to generate executable from LLVM IR -

i reading http://www.stephendiehl.com/llvm/#llvm-introduction there piece of llvm ir this: declare i32 @putchar(i32) define i32 @add(i32 %a, i32 %b) { %1 = add i32 %a, %b ret i32 %1 } define void @main() { %1 = call i32 @add(i32 0, i32 97) call i32 @putchar(i32 %1) ret void } i wanted try running using llvm , nasm failed: llc -march=x86-64 h1.bc -o h1.s nasm -f macho -o h1.o h1.s # failed here first lines of errors are: h1.s:1: error: attempt define local label before non-local labels h1.s:1: error: parser: instruction expected h1.s:2: error: attempt define local label before non-local labels h1.s:2: error: parser: instruction expected h1.s:3: error: attempt define local label before non-local labels h1.s:3: error: parser: instruction expected h1.s:4: error: attempt define local label before non-local labels the code generated llc not seem native os x assembly code described @ http://peter.michaux.ca/articles/assembly-hello-world-for-os-x what's ri

php - mysql mod function return negative number -

great example issue calculate remaining days birthday i using datediff(currdate(),"birthday column") function , receive days difference , need mod 365. mod 365 retrieving 364 if contact had birthday yesterday. datediff(currdate(),currdate() - interval 1 day)= -1 mod(-1,365) = -1 :\ wired! i find solution issue mod(mod(negative,365)+365),365) use `test`; drop procedure if exists `get_user_contacts`; delimiter $$ use `test`$$ create procedure `test`.`get_user_contacts` (user_id int(11),lim int(11)) begin declare is_user_exist int(11); select count(*) is_user_exist users `users`.`id` = user_id; if is_user_exist =1 select `contacts`.*,mod(mod(datediff(curdate(),`contacts`.`birthday` + interval (extract(year curdate())-extract(year `contacts`.`birthday`)) year)*(-1),365)+365,365) diffdate contacts left join contacts_users on `contacts`.`id` = `contacts_users`.`contact_id` left join users on `contacts_users`.`user_id` = `us

javascript - Disable select in Angular? -

on page located html select list: <select ng-model="names" disabled="{{disabled}}" name="names" class="form-control input-medium"> and in controller: $scope.disabled = true; and ng-change : $scope.changespecialization = function (id){ console.log(id); // gives value more 0 if(id > 0){ $scope.disabled = false; } } how can see in method changespecialization catch id , check zero. console returns me value more zero. after changed $scope.disabled false. on page select list still disabled. you should use ngdisabled directive. this directive sets disabled attribute on element if expression inside ngdisabled evaluates truthy. code example <select ng-disabled="disabled" ng-model="names" name="names"> </select>

python 3.x - 'float' object is unsliceable -

i'm trying generate 2 classes of random 2d points, 1 having mean of [1,1] , other mean of [-1,-1]. have written function error can't figure out. googled didn't find anything. here's function : def gen_arti_bis(nbex=10,centerx=1,centery=1,sigma=0.1,epsilon=0.02): xpos=np.random.multivariate_normal([centerx,centery],np.diag([sigma,sigma]),nbex/2) xneg=np.random.multivariate_normal([-centerx,-centery],np.diag([sigma,sigma]),nbex/2) data=np.vstack((xpos,xneg)) y=np.hstack((np.ones(nbex/2),-np.ones(nbex/2))) return data,y and here's error message when type gen_arti(): traceback (most recent call last): file "<ipython-input-64-a173cf922dac>", line 1, in <module> gen_arti_bis() file "<ipython-input-63-da8720093c11>", line 2, in gen_arti_bis xpos=np.random.multivariate_normal([centerx,centery],np.diag([sigma,sigma]),nbex/2) file "mtrand.pyx", line 4308, in mtrand.randomstate.multivar

logging - How to filter nested parameters from Rails logs -

i see can filter keys rails logs here , it's not entirely clear how can filter key nested inside parameter hash. my params hash looks this: {"download"=>{"attachment_id"=>"54039", "data"=>"data:image/png;base64,ivborw0..."}} where params[:download][:data] base64 string. large amount of data , remove logs. is possible? i'm using rails 4.0.4 simply put in application.rb: config.filter_parameters += [:data] this filter nested [:data] keys also. in rails 5, can define hierarchy of key: config.filter_parameters += ["download.data"] this filter [:data] keys have [:download] immediate parent.

android - cannot combine custom titles with other title features -

Image
i have created custom title bar 1 of screen , trying use same concept in other ,but getting android.util.androidruntimeexception: cannot combine custom titles other title features . requirement: styles.xml: <?xml version="1.0" encoding="utf-8"?> <resources> <style name="titlebarheading" parent="@android:style/textappearance"> <item name="android:textsize">17sp</item> <item name="android:textstyle">bold</item> <item name="android:textcolor">#444444</item> </style> <style name="customwindowtitlebarbg"> <item name="android:background">#323331</item> </style> <style name="titlebartheme" parent="android:theme"> <item name="android:windowtitlesize">35dip</item> <item n

java - How to enlarge edittext when focussed. (like google chrome url field) -

how can enlarge edittext when being focussed , default when unfoccused. (like google chrome url field) the edittext @+id/edittext here code: --custom_actionbar-- <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="50dp"> <edittext android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/edittext" android:hint="@string/url" android:inputtype="text|textnosuggestions" android:imeoptions="flagnoextractui|actionsend" android:selectallonfocus="true" android:background="#ffe0e0e0" android:layout_centervertical="true" android:layout_alignparentleft="true" android:layout_a

asp.net MVC FormsAuthentication for claim based authentication -

we using gigya authenticate user provide user id , email. pass user detail our crm web service return user data crm. we need create session user can identify whether user logged in or not. if not logged in redirect gigya login/register etc. now, given not using asp.net membership or similar, i'm thinking how going secure member pages. 1 way can think of store user detail in session. check if user detail exists in session, if doesn't exist prompt login. i'm thinking whether: i can use formsauthentication.setauthcookie or similar create asp.net session or there better way achieve this. also, if use formsauthentication.logout clear session , cookies though i'm not using asp.net membership provider? goal: to able create session user able authorize user based on user role crm. able logout user on lout button click. first, , very important security perspective. authentication != session. they different concepts. second, never