Posts

Showing posts from February, 2014

javascript - Security issues with reading a JS array? -

i'm building website have js multi-dimensional array in .js file in scripts folder on server. in array video embed codes (vimeo iframes) , additional strings composers, players , piece names. there 1000 videos in array. var videos = [ ['embed code', 'composer name', 'player name', 'piece name'], ['embed code', 'composer name', 'player name', 'piece name']...]; there search text box users specific searches composer, player, etc. jquery script iterate through each inner array find matches user's query , present them on page. this: function getarray(video) { if (campyear === video[j]) { var pos = video.indexof(video[j]); $('#searcharea').append('<td>' + video[(pos - pos)] + '</td><td><h3>composer: ' + video[(pos -pos) + 1] + '</h3><br><h3>player: ' + video[(pos - pos) + 2] + '</h3><br&

mysql - Loading page with a single record from a list of records. [PHP] -

i'm complete beginner using mysql database , php i'm looking load single record page list of records clicking link. i've got list of records working , when link clicked takes user page url: /view.php?v=1 (with 1 being id of record clicked on menu) how load relevant record (the 1 '1' id) on page? seems simple can't find how anywhere. obviously need use sql statement content database need put? like: $sql = "select * topics topicid=v"; use url's variable $_get $topic_id = $_get['v']; you can pass parameters in query rather dumping variable: $query = $pdo->prepare(select * topics topicid=:topic_id); $query->bindvalue(':topic_id', $topic_id); this document guide more. http://php.net/manual/en/ref.pdo-mysql.php

c++ - Recursive equation implementation issue -

i given assignment few months ago had handful of random components. 1 recursive function had lot of fluff shouldn't have been hard. however, couldn't figure out how write it. i've gone , still can't quite figure out. can see full assignment here if you'd like: http://www.cs.fsu.edu/~asriniva/courses/ds14/projs/proj2.html i'm dealing section called main.cpp: program evaluate recursive function. has nothing previous part of assignment. command: ./recurse n1 c1 a1 m1 m2 m3 m4 d1 d2 s1 s2 arg op cause function given below evaluated recursively , answer output. function defined follows. f(n) = 0, if n < n1 f(n1) = c1 f(n)= a1 + m1*f(m2*n/d1 - s1) op m3*f(m4*n/d2 - s2), if n > n1 here, f(arg) needs evaluated. n1 c1 a1 m1 m2 m3 m4 d1 d2 s1 s2, arg integers , op either + or -. division performed usual integer division truncation. i got semi working program but, first, uses global variable, second, warning "recurse.cpp:37: warning: control reache

asp.net - .NET & AngularJS slow response times on Appharbor -

on appharbor response time our activity logs on 2 minutes @ points , 30 seconds login. using service ping server keep , running minimal effect. here repository: https://github.com/343-epoch/epoch-trackr are doing appharbor doesn't like? responses slow on local more in range of couple seconds. also, firefox , internet explorer load faster doesn't make sense me. here links 2 different instances running on appharbor, 1 1 build , 1 of our builds. have separate ones because earlier appharbor injecting code previous builds latest somehow (it random , not every instance). still have no clue how happening , made new instance. epoch-trackr.apphb.com epoch-trackr-prod.apphb.com

How to run an R script file from the command line -

i know there lot of questions regarding issue i've tried , think don't understand how command line works in windows. have file saved in folder on desktop, let's say: c:\users\abika_000\desktop\r models\myfile.r here directory r/bin or rscript/bin: c:\program files\r\r-3.1.0\bin i want run code using cmd prompt. how go doing this? i've tried solution question below keep getting errors no matter do: run r script command line what entered: > r cmd batch c:\users\abika_000\desktop\r models\myfile.r > rscript c:\users\abika_000\desktop\r models\myfile.r the errors are: 'r' not recognized internal or external command, operable program or batch file 'rscript' not recognized internal or external command, operable program or batch file edit:: credit splendour , phil. wound fixing entering: > "c:\program files\r\r-3.1.0\bin\"r cmd batch "c:\users\abika_000\desktop\r models\myfile.r" i apologize poor ques

javascript - creating a "responsive number" directive with angular and bootstrap -

i'm working on directive allow numeric field displayed in friendly way based on amount of space available number if, instance, have field value of 10,000,000,000 show 10b (b billion) if there not enough space full value of 10,000,000,000. i wanted work bootstrap. best approach think of involved wrapping element in parent element sized bootstrap (and target element react accordingly). able working, imagine there's better approach. here html example (the directive "responsive-number" attribute): <div class="container-fluid"> <div class="row"> <div class="col-md-4">some label: </div> <div class="col-md-8"> <div responsive-number ng-model="somevalue"></div> </div> </div> </div> the directive, upon initial rendering, sets element's max-width parent node's innerwidth(). limitation here can't have ot

php - How to loop trought array and create array from common values? [Solved] -

i need filter array , spilt them different arrays. here actual working , slow code: -----> http://viper-7.com/gvrbvp but method still slow, think. @ least 3 loops... scan 1 time array , create array on fly, tried this: $stray = json_decode('[{"id":"1","zona":"pescara"},{"id":"2","zona":"pescara"},{"id":"3","zona":"teramo"},{"id":"4","zona":"pescara"},{"id":"5","zona":"pescara"},{"id":"6","zona":"teramo"},{"id":"7","zona":"pescara"},{"id":"8","zona":"pescara"},{"id":"9","zona":"pescara"},{"id":"10","zona":"pescara"},{"id":"11","zona":"pescar

html5 - Intro video using <video> tag -

i trying create introduction video website without using flash. should pop when page loaded , there should option skip it. possible using html5? i cannot find this. find things on how create video or video tag in general. i new , happy kind of help! <video src="intro.mp4"></video> <a href="page2.html">skip</a>

mysql - using LIKE %% with LEFT JOIN -

ok, used "like" "left join" , works fine. $sql = $conn->query("select * tasks t left join users u on t.allowed_countries u.country u.username = '$username'"); but when i'm try use "like %%" instead of using "like" gives me error like '%" u.country "%' can tell me problem please? thank you. use concat % char literal. like concat('%',u.country,'%')

dictionary - Multiplying polynomials in Python with the use of dictionaries -

i have written little class initializer takes argument dictionary. following dictionary {2:3, 4:5, 6:7} translates polynomial 3x^2 + 5x^4 + 7x^6 keys of dictionary exponents , values coefficients. i have managed implement comparison of 2 polynomials in class using eq method , can add them. here code: class polynomial(object): def __init__(self, polynom = {}): self.polynom = polynom self.poly_string = self.nicepolynom(polynom) #just method make output nice def __str__(self): return self.poly_string # debugging purposes def coefficient(self, exponent): """ small function returns coefficient of corresponding exponent i.e. if our polynomial p = 3x^9 p.coefficient(9) return 3 """ try: return self.polynom[exponent] except keyerror: pass def __add__(self,other): """ overloading + operator not elegant solution understandable. check first if our exponent present in b

C++ Function causing app to crash and not working properly -

a problem has come in application printall function not work correctly , crash application. app supposed read strings file , insert them array. problem is reading incorrectly , crash app. here think problem lies: int main() { loadmovies(); movielist *movies = loadmovies(); //movies->movielist::printall(); // // test methods movie , movielist classes //printallmoviesmadeinyear(movies, 1984); //printallmovieswithstartletter(movies, 'b'); //printalltopnmovies(movies, 5); //delete movies; return 0; } movielist* loadmovies() { vector<string> movies; readmoviefile(movies); movielist ml = movielist(movies.size()); string name; int year; double rating; int votes; (int = 0; < movies.size(); i++) { istringstream input_string(movies[i]); getline(input_string, name, '\t'); input_string >> year >> rating >> votes; movie movi

node.js - How do I require a directory in a node_module? -

to make gulpfile.js easier read, put of gulp tasks in gulp/ directory. thing in gulpfile.js require in whole directory this: var requiredir = require('require-dir'); requiredir('./gulp'); an example task file `default.js' gulp.task('default', function() { // stuff here }); i use same gulp stuff in multiple projects, create npm module , packaged of gulp tasks it. when try change gulpfile.js point @ directory same contenxt in node_modules this: var requiredir = require('require-dir'); requiredir('./node_modules/my-gulp/gulp'); it doesn't find of tasks. same directory before, why won't work? can pull in multiple gulp tasks in manner?

mysql - CASE w/ DATEADD range to SUM column multiple times for future earnings estimate -

edit: original post follows, bit long , wordy. edit presents simplified question. i'm trying sum 1 column multiple times; i've found, options either case or (select) . trying sum based on date range , can't figure out if case allows that. table.number | table.date 2 2014/12/18 2 2014/12/19 3 2015/01/11 3 2015/01/12 7 2015/02/04 7 2015/02/05 as separate queries, this: select sum(number) alpha table date >= 2014/12/01 , date<= date_add (2014/12/01, interval 4 weeks) select sum(number) beta table date >= 2014/12/29 , date<= date_add (2014/12/01, interval 4 weeks) select sum(number) gamma table date >= 2014/01/19 , date<= date_add (2014/12/01, interval 4 weeks) looking result set alpha | beta | gamma 2 6 14 original: i'm trying return sum of payments due within budgeting time frame (4 weeks) current budgeting period , 2 future periods. students p

osx - How to accept "open document" events in py2app based Python app when the app is already running? -

i've been building 64 bit python 3.4.2 app on os x 10.10, bundle mac app using py2app 0.9. have adapted app's info.plist file, os x knows files file name suffix can opened app. when user double-clicks file file name suffix in finder, opens app , sends name of double-clicked file argument app. if app running, though, , double-click second file matching file name suffix, file name doesn't seem handed on app. and try implement: no matter if app running, if double-click matching file in finder, should opened in app. i have seen py2app creates file contents/resources/ boot .py, seems catch odoc apple event sent finder, , sends python app. i added logging boot .py file , saw boot .py doesn't seem invoked when py2app bundled python app running , double-click file in finder. any input appreciated. thanks lot in advance, andré i learned, tk on mac can process appleevents, e.g. opening documents. there's example @ code.activestate.com/lists/pyth

angularjs - Bad request in MEAN stack app trying to append to an array in a schema -

i trying pass array of interest rates mongoose schema consisting of accounts. want store interest rates change @ dates. however, when trigger create function dev tools tell me have done bad: **400 bad request** i have been using this template. the view: has been disconnected pass: var interest = { rate: 1, date: date.now() }; the controller updating: // create new account $scope.create = function() { // create new account object var account = new accounts ({ name: this.name, desc: this.desc, interests: [] }); // problematic part // store interest: var interest = { rate: 1, date: date.now() }; account.interests.push(interest); // problematic part end // redirect after save account.$save(function(response) { $location.path('accounts/' + response._id); // clear form fields $scope.name = ''; }, function(errorresponse) { $scop

user interface - How to creat clickable links from a list in powershell GUI -

i writing powershell tool friend him manage more server checks. have folder store daily logfiles. want option tool lists files , can click on , opens automatically. this code reads folder: function reportlist { $reportfiles = $psscriptroot + "\reports\" $reportlist = get-childitem -path $reportfiles foreach ($report in $reportlist) { $outputbox.text += "" + $report + "`n" } } so read files using get0chiditem , stuff whole thing textbox line line. , how looks in gui window ( can't post images) report_1_date_xx_xx_xxxx.html report_2_date_xx_xx_xxxx.html report_3_date_xx_xx_xxxx.html report_4_date_xx_xx_xxxx.html report_5_date_xx_xx_xxxx.html these files turn links in html example. possible achieve gui? when list different windows propertys in textbox result appears link don't know how written. how great. here how create de output box. rich textbox $outputbox = new-object system.windows.forms.richtextbox

postgresql - Remove duplicate column after SQL query -

i have query i'm getting 2 columns of houseid : how one? select vehv2pub.houseid, vehv2pub.vehid, vehv2pub.epatmpg, dayv2pub.houseid, dayv2pub.trpmiles vehv2pub, dayv2pub vehv2pub.vehid >= 1 , dayv2pub.trpmiles < 15 , dayv2pub.houseid = vehv2pub.houseid; and also, how average of epatmpg ? query return value? the elegant way use using clause in explicit join condition: select houseid, v.vehid, v.epatmpg, d.houseid, d.trpmiles vehv2pub v join dayv2pub d using (houseid) v.vehid >= 1 , d.trpmiles < 15; this way, column houseid in result once , if use select * . per documentation: using shorthand notation: takes comma-separated list of column names, joined tables must have in common, , forms join condition specifying equality of each of these pairs of columns. furthermore, output of join using has 1 column each of equated pairs of input columns, followed remaining columns each table. to average epatmpg

scala - Communication between an application in play activator and server in amazon aws -

i have been studying several blogs couldn't clear picture.i building web application uses scala actors concurrency.my basic goal concurrently update shared file in server.and planning use aws it. see in several blogs people talking deploying play application in aws.does mean install whole activator play v2.3.5 in aws or place application.if placing application how can modify , test activator. can 1 give clear picture of process follow build application?. these blogs researched. may understandable couldn't clear picture being naive. http://rijware.com/play-application-amazon-ec2-instance/ https://aishwaryasinghal.wordpress.com/2012/05/18/deploy-play-2-application-on-aws-with-tomcat-and-apache-httpd/ , few more.. here few things "may" understand play , how can deployed on ec2. play containerless web framework - i.e., don't need deploy play application container (like traditional container based web frameworks such jboss , tomcat). instead use li

c# - Scroll panel with image using keyboard (PageDown / PageUp) -

what right way show large image in winforms app scroll-bars , keyboard scroll support? currenty i'm use panel(autoscroll=true) nested piturebox (sizemod = autosize). i have 2 question: 1) control select drawing image? panel , piturebox cant selected (focused) using tab key. using button autosize = true , flatstyle = flat right solution? 2)how scroll image in panel using keyboard. keyboard events need handle - form, panel or picturebox. may should set panel autoscroll=false , add them hscroll , vscroll, events should handle? what right way implement elementary app? (just info, main form have other panel(dock=top) contain controls.) as first question: there no control suited draw on , still can focus . in link below can see how make selectable panel , though. now real problem: how scroll autoscroll panel keyboard..? this amazingly hard do. here example start: private void form1_previewkeydown(object sender, previewkeydowneventargs e) { if (panel1.boun

python - Issues intercepting subprocess output in real time -

i've spent 6 hours on stack overflow, rewriting python code , trying work. doesn't tho. no matter do. the goal: getting output of subprocess appear in real time in tkinter text box. the issue: can't figure out how make popen work in real time. seems hang until process complete. (run on own, process works expected, it's thing has error) relevant code: import os import tkinter import tkinter.ttk tk import subprocess class application (tk.frame): process = 0 def __init__ (self, master=none): tk.frame.__init__(self, master) self.grid() self.createwidgets() def createwidgets (self): self.quitbutton = tk.button(self, text='quit', command=self.quit) self.quitbutton.grid() self.console = tkinter.text(self) self.console.config(state=tkinter.disabled) self.console.grid() def startprocess (self): dir = "c:/folder/" self.process = subprocess.popen([ &qu

java - Join in mapreduce -

i working on map reduce join problem using joiner , splitter functions. have searched lot on google , finds adding guava-18.0.jar file in referenced libraries of project. attached javadoc location jar file still getting error mentioned below: error: java.lang.classnotfoundexception: com.google.common.base.splitter @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:354) @ java.lang.classloader.loadclass(classloader.java:425) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:308) @ java.lang.classloader.loadclass(classloader.java:358) @ edu.cs.okstate.cs.partitioning.partition_mapper.setup(partition_mapper.java:29) @ org.apache.hadoop.mapreduce.mapper.run(mapper.java:142) @ org.apache.hadoop.mapred.maptask.runnewmapper(maptask.java:764) @ org.apache.hadoop.mapred.maptask.run(maptask.java:364) @ org.apache.hadoop.mapred.child$4.run(child.java:255) @ java.security.ac

How Do I Prevent MATLAB from Dropping the "complex" Attribute of an Array? -

the following matlab code snippet, creates 2 arrays of complex numbers, x = complex(1:2,0:1); y = complex(zeros(1,2),0); whos x y prints name size bytes class attributes x 1x2 32 double complex y 1x2 32 double complex as expected. however, after these 2 additional statements, y(1) = x(1); whos x y the following gets printed: name size bytes class attributes x 1x2 32 double complex y 1x2 16 double how can 1 prevent complex attribute being dropped? for record, octave same. in practice, x function argument first entry happens have 0 imaginary part, , y return value being preallocated. if want make sure complex data type maintained, explicitly cast number complex . therefore: y(1) = complex(x(1)); because x(1) has real component, matlab automatically converts real in order save spac

jwrapper splash screen shrinks splash image -

we have image blue background use splash screen above jwrapper splash logo, however, when jwrapper builds exe, logo shrunk , there white border around it. there way fix this? this expected behaviour, jwrapper allows use image , rescale fit splash dialog size. there isn't way specify different size of splash dialog.

mysql - SQL join 3 tables grouped with latest group value -

i have 3 tables. user, messages , user_analytics following structure: user (userid) - contains users message (messageid(pk),userid(fk),time) - contains messages user_analytics (user_analyticsid(pk),userid(fk),device,time) - contains data collected on connection user : messages (1:n) user : device (1:n) now know how many messages sent on each day device. therefor first need collect each message device (desktop,ios,android) used send message depending on message time itself. means need user_analytics.time <= message.time , display latest result. i saw lot solutions greatest-n-per-group didn't work. i work subquery takes 20 seconds (user_analytics holds 100k records , message 3k... not much): select date_format(m.time,'%y-%m-%d') date, count(*) message_count, ua.device message m, user u left join user_analytics ua on ( u.userid = ua.userid , ua.user_analyticsid = ( select max(user_analyticsid)

c++ - How do you initialize struct size/length -

i have create struct , run in loop not problem has run specific number of times user chooses how do ? ex: struct employee { name department salary }; if want run ten times can use for (int x=0, x<10, x++) .... but if have ask user number , not keep @ 10 ? also idea on how error check name using getline wrong input (numbers). thanks ton guys. new c++ , trying learn if can give me examples explanations appreciated. thank time. thanks input. see how name checking can done apologize unclear question. when declare struct in main asks me how many info intend put in struct. ex: employee e[10]; i dont know how ask user before , make his/her response const int . (10 in case const int). let's assume variable n keep entered value of user. int n; then loop like for ( int x = 0; x < n; x++ ) { // code } the value in n can entered means of operator >>. std::cin >> n; to check name contains letters can apply algorithm std::

visual studio 2013 - C++ template : unable to match function definition to an existing declaration -

i designing templated vector2 class, game engine. in order keep tidy, have been separating function declarations , definitions. working fine constructors, however, following error when trying same static function: error c2244: 'spl::vector2<t>::dot' : unable match function definition existing declaration 1> definition 1> 't spl::vector2<t>::dot(const spl::vector2<l> &,const spl::vector2<r> &)' 1> existing declarations 1> 't spl::vector2<t>::dot(const spl::vector2<l> &,const spl::vector2<r> &)' what finding unusual despite fact declaration , definition identical, compiler fails match them. here vector2 class: // vector2 class template <typename t> class vector2{ public: // constructor vector2 (); vector2 (t value); vector2 (t xaxis, t yaxis); // static functions template <typename l, typename r> static

php - mysqli_real_escape_string($link,$_REQUEST) for all variables -

i'm using mysqli first time . in mysql have used . $escapedget = array_map('mysql_real_escape_string', $_request); extarct($escapedget ). now have tried lot mysqli_real_escape_string mysqli_real_escape_string($link,$_request) it says second parameter should string , tried passing string loop , can't make work , can please . thanks in advance i way: function sanitize($value){ global $mysqli; return $mysqli->real_escape_string($value); } if($_post){$_post = array_map('sanitize', $_post);} if($_get){$_get = array_map('sanitize', $_get);} if($_cookie){$_cookie = array_map('sanitize', $_cookie);} if($_request){$_request = array_map('sanitize', $_request);}

Get column count using Sqlite -

this question has answer here: how count number of columns in table in sqlite? 4 answers how can column count in table using sqlite. tried select count(*) information_schema. columns c table_name = 'test' , table_schema = "test" works fine sql doesnt works sqlite. there other way getting column count. thank you..! try pragma table_info(table_name); give columns information-name,type etc. refer http://www.sqlite.org/pragma.html

Printing Python into HTML -

hi there? wondering if there code on how print results of python code html. trying find way print result html. if trying integrate python webpage, solutions flask , django . flask more focused on simplicity, instead of functionality, while django has more functionality. be sure read on respective documentation.

jboss - Apache Modcluster failed to drain active sessions -

i'm using jboss eap 6.2 webapplication server , apace modcluster load balancing. whenever try undeploy webapplication, following warning 14:22:16,318 warn [org.jboss.modcluster] (serverservice thread pool -- 136) modcluster000025: failed drain 2 remaining active sessions default-host:/starrassist within 10.000000.1 seconds 14:22:16,319 info [org.jboss.modcluster] (serverservice thread pool -- 136) modcluster000021: pending requests drained default-host:/starrassist in 10.002000.1 seconds and takes forever undeploy , eap server-group , node in application deployed becomes unresponsive. the workaround restart entire eap server. question is, there attribute can set in eap or modcluster active sessions beyond maxtimeout expire itself? to control timeout stop context can use following configuration value: stop context timeout the amount of time, measure in units specified stopcontexttimeoutunit , wait clean shutdown of context (completion of pendin

Perl DBI Return install_driver(Oracle) failed -

i have problem when using padre ide write perl script as #!/usr/bin/perl use dbi; $dbh = dbi->connect('dbi:oracle:host=localhost;sid=orcl;port=1521', 'user', 'password', { raiseerror => 1, autocommit => 0 }); it raises error *install_driver(oracle) failed: can't locate loadable object module dbd::oracle in @inc (@inc contains:d:/dwimperl/perl/site/lib d:/dwimperl/perl/vendor/libd:/dwimperl/perl/lib .) @ (eval 54) line 3 compilation failed in require @ (eval 54) line 3. perhaps module dbd::oracle requires hasn't been installedat test.pl line 19* but if manually run two-line perl script in command runs successfully. try installing version of strawberry perl, ships dbd::oracle. http://strawberryperl.com/release-notes/5.20.0.1-64bit.html be sure read notes on site concerning oracle client , path setup. hth

c - Passing global pointer to function -

i declare global struct word *root = null; populate using pthread calls(created bst) , when go print out inorder traversal function calling inorder(word *root), gives me error saying "unexpected type name 'word': expected expression". don't understand doing wrong. void ordered(word *root); // declaring function //code// word *root = null; // declare global pointer root /*main*/ //code work , creates bst root ordered(word *root); //call function follow these rules: you must specify variable type when declare function you may specify variable name when declare function you must not specify variable type when call function in example, variable type word* , variable name root . so change this: ordered(word *root); //call function to this: ordered(root); //call function

java - Refining the parsed json data -

a part of json recieved - "value":["14.1\""] . on using command - string = string.valueof(o.get("value")); i'm able extract whatever's in value field comes along square brackets, double quotes , slash in between. how retrieve data without square brackets, slash , double quotes? are sure json in format? value jsonarray jsonobject object = new jsonobject(s); jsonarray valuearr = object.getjsonarray("value"); string result =string.valueof(valuearr.get(0)); //you'll : 14.1" result = result.replace("\"","") // final: 14.1

node.js - best way for using famous in mobile meteor apps? -

i create example app (native ios/android) meteor , famous i´m little bit confused syntax of famous in meteor projects. looks there projects integrate famous packages meteor mjn:famous other projects use gadicohen:famous-views package. i tried famous university tutorials , fine in meteor have use famous-views syntax like: {{#famouscontext id="mainctx"}} {{#surface}} full size surface {{/surface}} {{/famouscontext}} the famous-meteor thing not documentated , can't find tutorials how combine them because there many packages. whats best or right way integrate famous meteor native mobile apps? you can use new package have created purpose. package name 'sgi:famous-angular'. package automatically includes 2 other packages: 1 loads angular , other loads famous you. package load current version of famous-angular. have sample app on github demonstrates how use package: https://github.com/pavlovich/meteor-angular-famous-demo the th

EditText field in Android to corectly format -

as title asks, want correctly monitor edit text field format entered numbers currency "." being l=placed or inserted after last 3 digits of cell. in user inputs numbers , field expands edittext reflect numbers entered reflect currency, example below: user enters "123456789" the edittext reflect : "123.456.789" any suggestions or comments welcome. try this edittext variablename = .... variablename.addtextchangedlistener(new textwatcher() { @override public void beforetextchanged(charsequence s, int start, int count, int after) { } @override public void ontextchanged(charsequence s, int start, int before, int count) { } @override public void aftertextchanged(editable s) { if(3 == s.length() % 4){ s.append('.'); // change fire event again, careful, avoid infinite loops } } });

c# - Can't include extended WPF-Toolkit -

i use extended wpf toolkik( https://wpftoolkit.codeplex.com/ ) stupid include it. i followed these steps: reference binaries in project: reference wpftoolkit.extended.dll in project (xceed.wpf.datagrid.dll datagrid control) add using statement ("using xceed.wpf.toolkit;" of controls, "using xceed.wpf.datagrid;" datagrid control) top of .cs files add new xmlns (xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" of controls, xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid" datagrid control) top of xaml files the using-statement in cs-file working! in xaml-file can´t find toolkit! i added this: xmlns:toolkit="http://schemas.xceed.com/wpf/xaml/toolkit" namespace not exist. http://fs1.directupload.net/images/141206/nx62yqa2.png so doing wrong? as @rshepp points out in comments, it's easier install wpf toolkit nuget package. go tools -> nuget package manager -> package manager con

c# - Can rectangle be split in rows and columns? -

Image
private void panel1_paint(object sender, painteventargs e) { pen mypen = default(pen); mypen = new pen(system.drawing.color.red, 3); mypen.dashstyle = system.drawing.drawing2d.dashstyle.dash; //for dash line in rectangle pen mypen1 = default(pen); mypen1 = new pen(system.drawing.color.blue, 1); mypen1.dashstyle![enter image description here][2] = system.drawing.drawing2d.dashstyle.dash; //pen mypen2 =default(pen); //mypen2 = new pen(system.drawing.color.yellow, 3); //mypen2.dashstyle = system.drawing.drawing2d.dashstyle.dash; //pen mypen3 = default(pen); //mypen3 = new pen(system.drawing.color.violet, 1); //mypen3.dashstyle = system.drawing.drawing2d.dashstyle.dash; l1 = rect1lt.x + 5; t1 = rect1lt.y + 5; w1 = rect1rb.x - rect1lt.x; h1 = rect1rb.y - rect1lt.y; e.graphics.drawrectangle(mypen, new system.drawing.rectangle(

c# - Is it possible to get "contextual" gestures in Monogame/XNA? -

i working on multi-touch app using monogame, multiple users can work on larger multi-touch screen separate documents/images/videos simultaneously, , wondering if it's possible make gestures "context-aware", i.e. 2 fingers pinching document on 1 side of wall shouldn't affect panning other side of wall. the way monogame works is, input points translated gestures, can read using: if (touchpanel.isgestureavailable) { var gesture = touchpanel.readgesture(); // stuff } is there way make gestures limited point on screen, or need implement myself? example, looking @ source code, appears touchpanelstate class work, unfortunately constructors internal . that feature not built in monogame, not part of original xna. you'd want more 1 'logical' touchpanel defined sub-rectangle of window. touchpanel static, hence there 1 whole game in default xna. the news monogame own gesture recognition. so, code there, need make changes monogame. eg.

stl - Conveniently view vector's content if iterator given -

is there convinient way see vector's content if need debug program in visual studio 2013 uses function signatures this: void foo(iterator begina, iterator enda); in case have vector<int> a can see inside of vector. if given iterator, then, debug purpose, need declare vector see inside, or there exists easier way? try begina._ptr,10 in watch window. relies on implementation detail of iterator (that has member called _ptr), , ,10 syntax in watch window means "treat pointer array address , show me 10 elements of array". can put arbitrary number there, doesn't have 10, of course. hth

html - css vertical and horizontal alignment issues -

Image
i'd align menu items , logo-picture both horizontally , vertically in red div. how achieve that? i've tried set margin left , right auto vertical-align center, didn't work. help see: http://jsfiddle.net/gm2wzl6z/ html: <div id="nav-container"> <nav> <ul id="navlist"> <li id="active"><a href="#" id="current">item one</a> </li> <li><a href="#">item two</a> </li> <li><a href="#">item three</a> </li> <li> <img src="http://lorempixel.com/output/fashion-q-g-227-148-4.jpg"> </li> <li><a href="#">item four</a> </li> <li><a href="#">item five</a> </li>

arrays - trying to scrape data of json in php not working -

why won't work should scrape definition pp , won't work :/ <?php $json_output = file_get_contents("http://api.urbandictionary.com/v0/define?term=pp"); $json = json_decode($json_output, true); $chuck_noris = $json['list']['definition']; print_r($chuck_noris ); ?> there still dimension inside $json['list'] (its still array) . can use foreach values inside it: $json_output = file_get_contents("http://api.urbandictionary.com/v0/define?term=pp"); $json = json_decode($json_output, true); foreach($json['list'] $list) { // $list hold each array inside `$json['list']` echo $list['definition'] . '<br/>'; } or explicitly pointing first result: echo $json['list'][0]['definition'];

javascript - customizing chosen jquery -

i have implemented multiple select using jquery chosen plugin. works fine. now consider select box contains following values: one one two one three two two three if type 'two', result displayed below, one two two two three but need customize matching results containing characters @ beginning should show first: two two three one two sample html below: <select class="chosen" data-order="true" name="multiselect[]" id="multiselect" multiple="true"> <option value="1">one</option> <option value="12">one two</option> <option value="13">one three</option> <option value="2">two</option> <option value="23">two three</option> </select> <script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script> <script ty

php - how to make codeigniter dynamic url search engine friendly -

question: how make codeigniter dynamic url search engine friendly? example: 1 my current url: after selecting menu called "articles" http://localhost/lw_user/home_control/getmenu/52 expected url: http://localhost/articles example:2 my current url: after selecting sub-menu called "thehindu" under menu "articles" http://localhost/lw_user/home_control/getpage/6 expected url: http://localhost/articles/thehindu note: dynamic url , contents fetching database what talking called slug . so, how use slug? will explain example: url - http://www.example.com/products/apple-iphone-5s-16gb-brand-new/ 1) assuming having product page , ofcourse product page needs data url understand product display. 2) before querying our database using id getting url. we'll same thing (querying our database) replacing id slug , thats it! 3) hence adding additional column in database named slug. below updated product database struct

c++ - Warning is shown when hovering mouse over QToolButton actions -

i have made qtoolbutton actions : qtoolbutton * toolbut1 = new qtoolbutton(this); actiongroup1 = new qactiongroup(this); actiongroup1->setexclusive(true); action1 = new qaction(qicon(":/images/icon1"),"", actiongroup1); action1->setcheckable(true); action2 = new qaction(qicon(":/images/icon2"),"", actiongroup1); action2->setcheckable(true); action3 = new qaction(qicon(":/images/icon3"),"", actiongroup1); action3->setcheckable(true); toolbut1->addaction(action1); toolbut1->addaction(action2); toolbut1->addaction(action3); but when hover mouse pointer on actions, warnings displayed in application output : qgradient::setcolorat: color position must specified in range 0 1 why happening? how fix it? p.s. using qt 4.8.4 on windows 7. i set different names these actions , result warning not shown more. qtoolbutton * toolbut1 = new qtoolbutton(this); actiongroup1 = new qactiong