Posts

Showing posts from January, 2012

c# - Drawing, and Appending to a Double-Horizontal Line -

c# - Drawing, and Appending to a Double-Horizontal Line - i know how draw straight lines in c#, draw horizontal line, 2 colors. lite bluish on top, , dark bluish on bottom. also, how sort of... append line? example, every few seconds, line become bigger... progressbar. (btw, i'm not creating progressbar, using example). here's kind of line i'd draw. aware can utilize picturebox. want start drawing! also, if there other ways of drawing, gdi or gdi+, list or link those? thanks! you can implement onpaint event on control , drawing manually on passed graphics object. c# .net winforms drawing gdi

c++ - Calculating quaternions from gyro + accelerometer data -

c++ - Calculating quaternions from gyro + accelerometer data - i have gyroscope + accelerometer info @ each period of time t . using c++, want calculate rotation of object @ each time - can rotate on axes. i've read convenient represent rotation of scheme in terms of quaternions (not in euler angles). how can transform angular velocity (from gyroscope) quaternions representation? think in order need solve differential equation using numerical methods. i'm not sure language you're looking for, c++ boost library has working quaternion class (quaternion.hpp). i've used library create simple rotation class computing results or rotating points arbitrary vectors little difficulty. update: based on comment, don't think need utilize quaternion library figure out angular position @ given time, given either constant angular velocity or angular acceleration. need figure out angle is, , utilize quaternion class compute position of vectors when rotated ...

Java EE 6 Maven Project Setup in Netbeans - some configuration issues? -

Java EE 6 Maven Project Setup in Netbeans - some configuration issues? - i've been trying set java ee 6 maven project via new project -> maven -> maven enterprise application. however, when seek run application i've been running couple problems: i had alter the http port glassfish listens on because port chose (8080) used. went domain.xml file , changed port 8081. when seek , run application, netbeans opening browser port 8080 still. there way alter this, netbeans opens browser port 8081? why when run web application why https beingness used instead of http? when https beingness used not finding index.jsp page... thanks help! go "services" tab, under "servers" find item represents glassfish instance. right-click on it, select "properties". alter location field "localhost:8081". java maven-2 netbeans java-ee java-ee-6

linux - How secure is storing sensitive information in a .PHP file on an Apache server? -

linux - How secure is storing sensitive information in a .PHP file on an Apache server? - i making easy-to-setup, no-database php website stores info instead in text files. the setup linux/apache/php server. up info has been non-sensitive, store in: ../data/system.txt theoretically type (url)/data/system.txt in browser , see info file in plain text, didn't matter now. but want store passwords various groups can log in , see different information. these sites "low interest" , "low profile" sites , if bored plenty hack site , sees information, it's not end of world, want provide modicum of technical hurdles site can have individual , grouping access rights while retaining ease of creating e.g. 50 of these sites without having set , maintain 50 databases. my question is, best way protect these text files on apache? i can think of following: 1) alter " ../data " directory random directory name, e.g. " ../data928374928374...

Polymer this.$ undefined in filter -

Polymer this.$ undefined in filter - i have function called formatdate. functions uses this.$ access global function in global element. problem getting error says this.$ undefined. not sure why ever undefined. defined in ready callback. edit: added code example. problem seen below in formatdate function. this.$ undefined. <link rel="import" href="app-globals.html"> <polymer-element name="message-element" attributes="message"> <template> <style> :host { display: block; } .message { padding: 10px; display: inline-block; margin-bottom: 6px; margin-right: 6px; margin-left: 6px; color: white; clear: both; max-width: 700px; } .sent-message { background-color: #3f51b5; float: right; } .received-message { background-color: #c5cae9; float: left; } .sent-...

Windows 8.1 Settings - Confirmation Message -

Windows 8.1 Settings - Confirmation Message - can scheme prompt message me confirm (yes or no) action when attempted move file recycle bin? right-click on recycle bin icon on desktop , select properties. now enable "display delete confirmation dialog" alternative , apply changes. windows windows-8.1

c# - Passing an object to another class? -

c# - Passing an object to another class? - i've been looking constructors, im trying pass object class file, way im doing this: class programme { static void main(string[] args) { class1 objpls = new class1(); objpls.namearray[0] = "jake"; objpls.namearray[1] = "tom"; objpls.namearray[2] = "mark"; objpls.namearray[3] = "ryan"; echodata form2 = new echodata(objpls); } } class class1 { public string[] namearray = new string[3]; } class echodata { public class1 newobject = new class1(); public echodata(class1 temp) { this.newobject = temp; } // why cant access newobject.namearray[0] example? } problem cant access object array.. what methods of passing objects there? told way , have been experimenting while no avail. not sure cannot do. illustration code modification works, or @ to the lowest degree compiles. class echoda...

c++ - Using OpenGL with Visual Studio 2013 Express -

c++ - Using OpenGL with Visual Studio 2013 Express - to give thought of trying do. goal create c++ programme in visual studio , using opengl display blackscreen , white dot in middle of screen. before can coding part though, have include opengl library somehow. looking @ opengl documentation it's installed, need initialize it. i'd rather not have initialization work it's been done several times, such freeglut, have 2 real problems not understand. 1) how compile freeglut? i've downloaded source code freeglut here http://prdownloads.sourceforge.net/freeglut/freeglut-3.0.0.tar.gz?download i configured cmake visual studio 2013 compatible project. 1 time open visual studio , seek compile it, bunch of errors saying: error c1083: cannot open include file: 'egl/egl.h': no such file or directory c:\freeglut-3.0.0\include\gl\freeglut_std.h 136 1 one_static 2) 1 time compiled, how link c++ project can do #include<freeglut.h> or ...

sql - Query syntax error in MySql -

sql - Query syntax error in MySql - here query , it's giving sql manual syntax error in mysql. select count(case when v.created_at = vv.minva user_id) num_new_users bills v bring together (select user_id, min(created_at) minva bills t grouping user_id ) vv on v.user_id = vv.user_id can please help me problem? the case statement should ended end select count(case when v.created_at = vv.minva user_id end ) num_new_users bills v bring together (select user_id, min(created_at) minva bills t grouping user_id ) vv on v.user_id = vv.user_id mysql sql

How to pass gnuplot a matrix and splot pm3d map in c? -

How to pass gnuplot a matrix and splot pm3d map in c? - so, time, have matrix called zvalue[10][10] , , draw pm3d map, normal x-y grids, , zvalue[i][j] value of point (i,j) . in gnuplot, use: set pm3d map splot zvalue matrix using 1:2:3 pm3d and in c++ gnuplot pipes, can utilize function gp.file1d() accomplish this. gp << "splot" << gp.file1d(matrix) << "matrix using 2:1:3" << "with pm3d\n" but now, in c gnuplot pipe, of course of study can write matrix file called zvalue.txt , , utilize following: fprintf(gp, "splot \"zvalue.txt\" matrix using 1:2:3 pm3d\n") but there other way? tried @christ's suggestion when deal normal splot matrix, like: int main(void) { file *gp = popen(gnuplot, "w"); fprintf(gp, "splot '-' matrix using 1:2:3\n"); int i, j; (i = 0; < 10; i++) { (j = 0; j < 10; j++) fprintf(gp, ...

php - How can I create a unique Wordpress username with Userpro plugin and its facebook connect? -

php - How can I create a unique Wordpress username with Userpro plugin and its facebook connect? - i using userpro plugin register new users. want utilize facebook connect feature. problem it registers username facebook username email address. unfortunately means email address on display in profile url. are these next solutions possible, , if how can alter code below create happen? i wordpress username first half of email plus sort of random number @ end of avoid duplicates. e.g. john.smith@gmail.com becomes john.smith536 or i wordpress username unique random mix of numbers or letters (to avoid duplicates). /* facebook connect */ add_action('wp_ajax_nopriv_userpro_fbconnect', 'userpro_fbconnect'); add_action('wp_ajax_userpro_fbconnect', 'userpro_fbconnect'); function userpro_fbconnect(){ global $userpro; $output = ''; if (!isset($_post)) die(); if ($_post['action'] != 'userpro_fbconnect...

string - How to read a input file in an array in c++ -

string - How to read a input file in an array in c++ - i'm trying store hexadecimal values form of array file alter numbers binary. far programme wrote collects lastly value. file looks this. note(a 1 or 0 before each hex value) 1 408ed4 0 10019d94 0 408ed8 1 10019d88 0 408edc 0 1001322 my code #include #include <fstream> #include <string> #include <cstdlib> #include <bitset> #include <sstream> #define max_addresses 1000000 using namespace std; int main(int argc, char **argv) { //declare variables int szl1 = atoi(argv[2]); int szl2 = atoi(argv[4]); string type = argv[6]; //determines type of cache //string filen = argv[7]; int info, = 1, j = 1; //info read in, & j testing variables string *rd_add = new string[max_addresses]; //set max string length what's read string *wrt_add = new string[max_addresses]; //set max string length what's written int total = 0; //total # of ...

matrix - How to search and extract values based on file names in R? -

matrix - How to search and extract values based on file names in R? - i have matrix a contain values. have other 24 matrices names of them are: the name of a1 data-00.img , name of a2 data-01.img, name of a3 data-02.img.........the name of a24 data-23.img what want @ first value in if na,return na if there value illustration 12, search in names of other matrices (should data-12.img) , extract corresponding value , set instead of 12 value in a .finally, same values in a . any help appreciated! = matrix( c(2, 4, 3, 1, 5, 7), nrow=2,ncol=3, byrow = true) a1 = matrix( c(3, 6, 3, 1, 9, 7), nrow=2,ncol=3, byrow = true) a2 = matrix( c(2, 3, 3, 1, 8, 3), nrow=2,ncol=3, byrow = true) a3 = matrix( c(2, 9, 3, 1, 5, 7), nrow=2,ncol=3, byrow = true) ...... a24 = matrix( c(2,9, 3, 1, 7, 7), nrow=2,ncol=3, byrow = true) above tried give reproducible example. question not clear, think need: #dummy info = matrix( c(2, 4, na, 1, 5, 7), nrow=2,ncol=3, byrow = true...

How does a set determine that two objects are equal in dart? -

How does a set determine that two objects are equal in dart? - i don't understand how set determines when 2 objects equal. more specific, when add method of set, adds new object, , when doesn't deed new object, because object in set ? for example, have objects next class: class action { final function function; final string description; action(this.function, this.description); call() => function(); tostring() => description; } now think next set contain 2 elements, 2 of them equal: void main() { set<action> actions = new set() ..add(new action(() => print("a"), "print a")) ..add(new action(() => print("a"), "print a")) ..add(new action(() => print("b"), "print b")); } but instead, set contains 3 action objects. see demo. how can create sure equal objects seen equal in set ? for comprehensive write-up operator== in dart see http://work.j8...

java - How to display on Web-page elements of sub-collection for chosen collection item? -

java - How to display on Web-page elements of sub-collection for chosen collection item? - can give thought how display on web-page elements of subcollection choosen collection item? illustration collection element vegetables correspond carrots, tomatoes, onions etc. in words contains types of product, each element of collection correspond elements in collection b. there standard components or solutions? use jstl tags. here quick reference guide started , and here example: <c:foreach items="${vegetables}" var="vegetable"> <c:foreach items="${vegetable.carrots}" var="carrot"> <ul> <li>${carrot.color}</li> <li>${carrot.size}</li> <li>${carrot.somethingelse}</li> </ul> </c:foreach> <c:foreach items="${vegetable.tomatoes}" var="tomatoe"> ...

java - How to pass bean value to javascript in jsp? -

java - How to pass bean value to javascript in jsp? - i trying pass int bean jsp page (using <%= testbean.getnumber()%> ). but when trying pass javascript in page, it's giving me error says: " non-static method cannot referenced in static context" . trying form loop in script, like: (int = 0; < (<%= testbean.getnumber()%>); i++) { // } anyone knows how pass bean value javascript? thanks. your bean name testbean looks class name. the compiler thinks trying access class method (an static method). if trying phone call instance method (non static), need define name of bean instance. the convention classes start uppercase names , instances utilize lowercase name. seek declaring bean instance next rule (lowercase name). for instance: <html> <head> <script> <% class samplebean { string _value; public string getvalue () { homecom...

java - Good Mobile and Desktop Architecture -

java - Good Mobile and Desktop Architecture - this question extension of 1 made in http://stackoverflow.com/questions/3782849/best-solution-architecture, want know best architecture deal solutions both desktop , mobile applications involved. in time know, if decided go on java technologies, how can build solution in order reuse much code possible. solutions must run on windows,linux , mac machines ( know using java , swing tech business , gui respectively , can accomplish requeriment). problem comes when decided incorporate android os mobile capability of our solutions, how can reuse code written desktop application ? how can expose business class service when trying avoid web or application servers installations ?. possible archive soa avoiding web o application server ? best developing techniques in order reuse much code possible ?. if guy has documention or comments point me in right direction solve problem i'd appriciate it. if trying avoid hosting web server co...

regex - Perl pattern matching and use of \k -

regex - Perl pattern matching and use of \k - i facing bit difficulty in using \k in regular expressions in perl. next lines need info after pipemed_tb array , skip part before can help that. if possible please tell how utilize \k in next lines. set stimulustop pipemed_tb.pipemed1.gtmc1.gthevcpar91.vncunit1 set stimulustop pipemed_tb.pipemed1.gtmc1.gthevcpar91.vneunit1 set stimulustop vprunit_tb.vprunit1 you must confusing \k<n> back-reference , perl \k preceding match omitting operator. not need here. here sample programme (part of redundant illustrative purposes): my @vals = (); push(@vals, "set stimulustop pipemed_tb.pipemed1.gtmc1.gthevcpar91.vncunit1"); push(@vals, "set stimulustop pipemed_tb.pipemed1.gtmc1.gthevcpar91.vneunit1"); push(@vals, "set stimulustop vprunit_tb.vprunit1"); foreach $i (@vals) { $i =~ s/set stimulustop //g; print $i."\n"; } output: pipemed_tb.pipemed1.gtmc...

c++ - Show an array arrangement -

c++ - Show an array arrangement - i wanting show array arrangement input # of rows , # of columns , insert symbol @ input interval.i have far output shows 1 row @ time until come in pressed how ever many rows selected. haven't started on interval symbol insertion yet. help on appreciated. #include <iostream> using namespace std; int rows = 0, columns = 0,intervals= 0; void display(int rows = 0, int columns = 0, int intervals = 0); int main() { cout << "enter number of rows: "; cin >> rows; cout << "enter number of columns: "; cin >> columns; cout << "enter number of question mark interval: "; cin >> intervals; cout << "\n"; cout << "how many rows want? " << rows << "\n"; cout << "how many columns want? " << columns << "\n"; cout << "how far between ques...

ios - Implement didReceiveRemoteNotification to show a new viewController when push comes -

ios - Implement didReceiveRemoteNotification to show a new viewController when push comes - i have application should loads viewcontroller when remote force notification comes, have code in appdelegate.m: - (void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo { nslog(@"remote notification %@", userinfo); if( [[mtmapiclient sharedclient] isloggedin: nil]){ if (userinfo && userinfo[@"aps"] && userinfo[@"aps"][@"extra"]) { if ( application.applicationstate == uiapplicationstateactive ) { [self playsound]; } } [notificationhelper pushnotificationcame:userinfo view:self.tabbarcontroller.selectedviewcontroller]; } } my application tabbed application (like appstore , itunes) maintain reference uitabbarcontroller in appdelegate. my notification helper code is: + (void) pushnotificationcame:(nsdicti...

validation - What is the Rails Convention for validating field length? -

validation - What is the Rails Convention for validating field length? - with activerecord models, know can validate length of input field so class user validates :user_name, length: { maximum: 20 } end however, 1 of design patterns in rails recommends lean models. if have ton of validations, above code might seem intimidating. read there way this. you can utilize activerecord::schema accomplish same task. class createusers < activerecord::migration def alter create_table :users |t| t.string :user_name, limit: 20 end end end that accomplishes exact same thing don't need sec line in users model. what standard rails convention regarding this? some people argue have have skinny controllers , skinny models. however, can create several additional classes in application. sometimes having fat model if documented , laid out logically can easier read. ignore 'best practices' if makes code easier read may not person touching ...

visual studio 2013 - Slow IO on Windows 7 development VM running on Hyper-V -

visual studio 2013 - Slow IO on Windows 7 development VM running on Hyper-V - i running complex moderately complex visual studio build takes 10 minutes finish on non-virtualized machine running on decent hardware (8gb memory,2.7 ghz i7, sshd). when run build on windows 7 invitee running on hyper-v/server 2012 (on precision 5810) takes on hr run. additionally, primary bottleneck of build when running build in non-virtualized cpu. when running build in windows 7 virtual environment bottleneck io. i post pictures of resource monitor, isn't giving me access since brand new account. anyways - cpu , memory both invitee , host not indicate intensive processing taking place, io high. queue length running steady between 10 , 50. 3 mb beingness read per/second while 8-10 mb written per second. active time of physical disk pegged @ 100%. running ram disk drastically reduces time here (to 6-8 minutes) isn't practical because can't afford dedicate necessary memory o...

c# - WEBAPI2 performance of many vs single controller -

c# - WEBAPI2 performance of many vs single controller - so, improve me create several requests single webapi2 controller or create same amount of requests many controllers. i.e single controller handling 10 requests perform worse 10 controllers handling 1 request each? either way please provide explanation of why , how 1 improve other how request handling different between two. exactly 0 difference. unless explicitly alter default behaviour, new controller instance created each request. whether create 10 instances of controller or 10 instances of controller b makes no difference: 10 instances either way. it shouldn't said if controller more expensive controller b have effect, obviously. c# .net performance asp.net-web-api2

java - Get an ID from an glassfish inherited entity -

java - Get an ID from an glassfish inherited entity - i created netbeans java web project called "restfulcontactmanager". i created several classes: contact, person, organisation, telephone. person , organisation inherits contact. i auto generated restful web service. when click on "test restful webservice" contact entity works perfect. i can perform "get" operation , works. the contact class: @entity @table(name="contact") @inheritance(strategy = inheritancetype.joined) @xmlrootelement public class contact implements serializable { @id @generatedvalue(strategy = generationtype.identity) private long id; private string naam; private adres adres; protected contact() {} @onetomany(mappedby="contact", orphanremoval = true) private list<telefoon> telefoons = new arraylist<>(); public contact(string naam, adres adres){ this.naam = naam; this.adres=...

java - Get string from ("\n") new line operator -

java - Get string from ("\n") new line operator - i have arraylist containing string abc"\n"1234,cde"\n"567 fgh"\n"890. want string found new line. array want 1234,567 , 890. here doing. says "incompatible types" have show dialog containing these contacts.and if user click on contacts opens dialer activity. for(string contact: manycontacts){ string contacts=contact.split("\\r?\\n"); } split returns string[] not string for(string contact: manycontacts){ string[] contacts=contact.split("\\r?\\n"); } if need 1 string have iterate on array , concatinate strings. or utilize commons-utils apache bring together it. java

android - Open random activities when button is clicked -

android - Open random activities when button is clicked - i have 5 activities. want happen open random activities when start button clicked on mainmenu. for example: activity 1 -> activity 4 -> activity 3 i have tried codes posted here , here none of them worked. this code in start button class="snippet-code-js lang-js prettyprint-override"> gotomenu=(button)findviewbyid(r.id.btnstart); gotomenu.setonclicklistener(new onclicklistener() { @override public void onclick(view arg0) { // todo auto-generated method stub startactivity(new intent(mainmenu.this, menu_welcomeluzon.class)); overridependingtransition(r.animator.transition_fade_in, r.animator.transition_fade_out); } }); any code snippets big help. in advance! to start activity, need utilize intents. , can phone call when button clicked so: button mybutton = (button) findviewbyid(r.id.my_button); mybutton.setonclicklistener(new view.oncl...

jQuery if div id has class, hide other div -

jQuery if div id has class, hide other div - i'm trying hide img id of "offer" if li id "print" has class frame3. frame3 class that's added front end slide on carousel i'm working on. seem have gotten working if utilize class. however, when combine id, no dice. appreciate help...thanks much! here's i'm working with. markup: <div class="main-container" style="position:relative;"> <ul id="slider"> <li><img src="images/img-1.png"><span><img src="images/slide-1-text.png"></span></li> <li><img src="images/img-2.png"><span><img src="images/slide-2-text.png"></span></li> <li><img src="images/img-3.png"><span><img src="images/slide-3-text.png"></span></li> <li><img src=...

java - player.getX() returning null -

java - player.getX() returning null - i've got function grabs players x co-ords , returns them, returning null reason can't quite figure out. (hence why i'm here). the exact error follows: java.lang.nullpointerexception @ dev.colors.level.level.getxoffset(level.java:78) all phone call this, line 78: if(player.getx() <= half_width){ this line come method: public int getxoffset(){ int offset_x = 0; //the first thing going need half-width of screen, calculate if player in middle of our screen int half_width = (int) (game.window_width/game.scale/2); //next maximum offset, right side of map, minus half of screen offcourse int maxx = (int) (map.getwidth()*32)-half_width; //now have 3 cases here if(player.getx() <= half_width){ //the player between left side of map, 0 , half screen size 0+half_screen offset_x = 0; }else if(player.getx() > maxx){ //the player between maximum point of scrolling...

Can you use the oracle dataadapter to select an XML from a database -

Can you use the oracle dataadapter to select an XML from a database - using xmlagg query (select xmlagg( xmlelement (... ) select xml database allow more command on format of info pickup. generating schema based of query gives standard polingstatments single record (which contains xml). creating schema xml easy (following advice on example) however, adding schema datastructure type of element doesn't work. can select schema in dropdown resets previous selected entry when selected other entry works. (in below image, order_header 1 i'd use.) i tried ignoring schema's , seeing if map results info in pollingstatement escaped <pollingstmtrecord><xml>&lt;order_header&gt;&lt;order_id&gt;206817&lt;/order_id&gt; has ever combined oracle dataadapter xml query? clue went wrong? stored procedure improve solution this? find way info doesn't alter < &lt; you have few options here: typed polling if utilize...

javascript - Changing src attribute of HTML5 audio element -

javascript - Changing src attribute of HTML5 audio element - i trying utilize js playback sounds. want have piece of music playing after time replace sound file. thought effective way reuse same sound object, seems not kill original sound gets messy. best way this? my code below, im doing passing in new source @ time function ingamesndcreate(src) { ingamesnd = new audio(src) ingamesnd.loop = true; ingamesnd.play(); } thanks in advance i expect you'll need alter source in dom using javascript. next should work. document.getelementbyid('audio_id').src = 'different_file.wav'; javascript audio html5

visual studio - View container of a control in a Form -

visual studio - View container of a control in a Form - i'm wont work netbeans, , visual studio can't find way view hierarchical relation of control(parent container ---> child) in form, this: is there way have view in visual studio 2010 c# programming language ? yes. utilize view + other windows + document outline. visual-studio visual-studio-2010

apache - Select Data From Solr Server in Java -

apache - Select Data From Solr Server in Java - i working in struts project , there using solr server database. i need java codes , procedure select, insert, update , delete. can 1 help me? solr not relational database, hence there no sql or relational algebra. to add/update/delete/query documents, utilize solrj library. here's quick tutorial. java apache solr

java - Switching links between multiple wars -

java - Switching links between multiple wars - we have big application having 13 modules. want create war file each module , deploy app ear. navigate different pages through top menu contains link modules. problem each module have own context. in order switch context using external.jsp <html> <head> <%@ include file="/private/jsp/header.jsp"%> <% string link= request.getquerystring(); %> </head> <body> <iframe id="ekawarframe" src="<%=link%>" width="100%" height="80%" scrolling="auto" frameborder="0"> </iframe> </body> </html> and using urls in format "/external.jsp?/app/newderivativetrade.do?method=loadnewderivativetrade&isfreight=false". there other elegant way navigate links between multiple wars. well, can link other modules using <a href="/anothermodule/">link</a> . problem sharing http sessi...

use anonymous function for other function's parameter in javascript -

use anonymous function for other function's parameter in javascript - i'm beginner on javascript. please watch code. function map(func, ary) { var =0; var array1 = ary; while(ary[i]!=null){ array1[i] = func(ary[i]); i++; } document.write('[' + array1[0] +',' +array1[1]+']'); //just check result } map(function(x) {return (x*4)/2;},[1,3,5,7]); i want operate " map(function(x) {return (x*4)/2;},[1,3,5,7]); " in javascript. how can operate code? please help me detail. i don't understand want ask. code works. utilize null, false, true instead of null false true. , aware document.write() bad way of displaying result. better ways are: create/get div, span, p or elem , utilize this: div.innerhtml = result; console.log(result); // press f12 open firebug/web tools . // map function returns result: function map(func, ary) { var = 0; var result = []; // empty array results while(ary[i] != null...

java - VK SDK for android problems -

java - VK SDK for android problems - i'm using android studio. i've downloaded vk sdk github , added in project file.also import it import com.perm.kate.api.api; i authorize, friends it api api = new api(account.access_token, constants.api_id); users = api.getfriends(account.user_id, "photo", null, null, null); insert them in db sharedpreferences prefs = preferencemanager.getdefaultsharedpreferences(c); sharedpreferences.editor editor = prefs.edit(); for(int =0; i< users.size();++i){ editor.putstring("friendfirstname" + string.valueof(i), users.get(i).first_name); editor.putstring("friendlastname"+ string.valueof(i), users.get(i).last_name); editor.putstring("friendphoto"+ string.valueof(i), users.get(i).photo); } editor.commit(); after, can of friend's name , it's working fine: names.add(prefs.getstring("friendfirstnam...

css - Can I combine :nth-child() or :nth-of-type() with an arbitrary selector? -

css - Can I combine :nth-child() or :nth-of-type() with an arbitrary selector? - is there way select every nth kid that matches (or not match) arbitrary selector? example, want select every odd table row, within subset of rows: class="lang-css prettyprint-override"> table.myclass tr.row:nth-child(odd) { ... } class="lang-html prettyprint-override"> <table class="myclass"> <tr> <td>row <tr class="row"> <!-- want --> <td>row <tr class="row"> <td>row <tr class="row"> <!-- , --> <td>row </table> but :nth-child() seems count tr elements regardless of whether or not they're of "row" class, end 1 even "row" element instead of 2 i'm looking for. same thing happens :nth-of-type() . can explain why? this mutual problem arises due misunderstanding of how :nth-child() , :nth-of...

type classes in Scala - a minimal self-contained example -

type classes in Scala - a minimal self-contained example - i looked @ examples type class scenarios , how imitate haskell-ish concept in scala, e.g. @ http://danielwestheide.com/blog/2013/02/06/the-neophytes-guide-to-scala-part-12-type-classes.html. think much involved , narrative-laden be. can provide authoritative minimal illustration polymorphism using type classes rather inheritance , mixins? thanks! // type class trait show[a] { def show(x: a): string } // usage def greet[a](x: a)(implicit sh: show[a]) = s"hello ${sh.show(x)}" // illustration instance implicit object showdouble extends show[double] { def show(x: double) = f"$x%1.3f" // format 3 digits } greet(math.pi) // "hello 3.142" scala

javascript - Dynamically sized div - fit text inside? -

javascript - Dynamically sized div - fit text inside? - i've got layout problem in web site. the layout right fixed it's default state (font doesn't fit page). want have page automatically stretches text in dynamically sized div (using percents). what thought of obtain width of element using offsetwidth() - , maybe js or jquery. maybe that's way go. i have made reconstruction of problem. it's text want allow stretch out fill whole div. so, if there text within fits on screen - let's phone call width x , height y - on screen has half size way much text (a scrollbar appear). on screen double size text small.so i'm looking command automatically resizes text fit in div. class="snippet-code-css lang-css prettyprint-override"> #left{ position: absolute; top: 0; left: 0; width: 50%; // variable width. height: 100%; } #right{ position: absolute; top: 0; left: 50%; width: 50%; height: 100%; } ...

linux - Crontab doesn't work with wget -

linux - Crontab doesn't work with wget - i set next cron tab when i'm under root user. * * * * * wget -q --spider http://mytargeturl.com/my/url/ the codes under same server owned user (and couldn't set crontab user). have request page wget because of mvc link scheme complexity. when run: crontab -l -u root i can see crontab setting. why reason crontab doesn't work? thanks. your syntax looks fine , should work. check /var/log/cron create sure indeed running, , if so, consider logging command's output file , inspect file pinpoint problem may be. linux crontab

c# - Translate anonymous function -

c# - Translate anonymous function - if have function parameter of type func<bool,bool> know can function has 1 parameter of type bool , returns bool too. i saw people pass here lambda : (x => x) , mean? how can translated normal function? it can compared regular method: public bool somemethod(bool x) { homecoming x; } effectively returning same variable provided lambda expression. c# lambda

Python 2.x or 3.x on a Chromebook -

Python 2.x or 3.x on a Chromebook - i'm trying programming. i've worked extent in javascript, html, etc. started python, , want able utilize acer c720 chromebook python. i've installed few things python shell chrome webstore, these lack modules need use, such tkinter. wandering if install total version of python (2.x or 3.x) via terminal (i'm in dev mode). you need install crouton on chromebook, , then, after dual booting (with sudo startxfce4 ), can open terminal , proceed tkinter program. python chromebook

android - Distinct values and count in MySQL -

android - Distinct values and count in MySQL - i have table contains messages have been saved orm database.i have messages table , users table using fetching , saving values. this sql query: select distinct ch.user _id, con.name, con.image, con.color, con.contact_id messages ch inner bring together users con on con.phone = ch.user order ch.timestamp asc i have boolean field status in messages table. want count of rows have status = false . can integrated in above prepared query, can results in single query? or need execute 1 fetching count of rows? you utilize sub select (check this fiddle): select distinct ch.user _id, con.name, con.contact_id, (select count(*) messages ch2 status = false , ch.user = ch2.user) my_count messages ch inner bring together users con on con.phone = ch.user order ch.timestamp asc; or you select result of select, migh...

javascript - How to properly load jQuery plugins on 3rd party website? -

javascript - How to properly load jQuery plugins on 3rd party website? - i'm building widget uses few jquery plugins work. it deployed via: <script src="http://example.com/widget"></script> <div id="widget"></div> and fetched script looks this: (function() { var jquery; // jquery on page; if there, utilize it, otherwise fetch if (window.jquery === undefined || window.jquery.fn.jquery !== '2.1.3') { loadscript("//code.jquery.com/jquery-2.1.3.min.js", scriptloadhandler); } else { jquery = window.jquery; loadexternallibraries(); main(); } // fetch 3rd party libraries server function loadexternallibraries() { <% widget_javascripts.each |filename| %> var url = "//example.com/widget/javascripts/" + "<%= filename %>"; loadscript(url, function() { console.log("added " + "<%= filename%>"); }); ...

ios8 - iOS share extension NSUserDefaults issue with stored auth token -

ios8 - iOS share extension NSUserDefaults issue with stored auth token - i utilize restkit library handle request. utilize base of operations authorization , maintain token in user default. here example how info app nsuserdefault , utilize in share extension. so made this: nsuserdefaults *userdefaults = [[nsuserdefaults alloc] initwithsuitename:@"group.com.myapp"]; nsstring *token = [userdefaults objectforkey:@"kusertoken"]; but token nil when check same in app homecoming me string. also noticed have error (not sure if causes error user defaults): add “app groups” entitlement app id ios ios8 ios8-extension ios8-share-extension

How can we store .pdf .ppt .txt .doc files into the database? -

How can we store .pdf .ppt .txt .doc files into the database? - i wants store .pdf , .ppt , .txt .doc etc type files database , there datatype in dbms store such type of files or create kind of conversion before putting database column? the easiest way store such binary info utilize blob (binary big object). there no other specialiced datatypes binary info available. database

c# - Entity Framework using edmx on MySQL MAC/Linux using Mono -

c# - Entity Framework using edmx on MySQL MAC/Linux using Mono - i setup entity framework 6 project using database first (edmx) on windows using visual studio 2013 , made work point @ mysql on mac machine. opened same project in xamarin studio on windows machine , made work. moved whole thing on mac , ran using xamarin there, , suprise worked! but, rebuilt project had entity framework objects in it. , stopped working. trying figure out why buidling using xamarin doesn't work , if possible prepare problem. c# mysql osx entity-framework mono

security - What protection is needed for PHP mail scripts? -

security - What protection is needed for PHP mail scripts? - this question has reply here: how prevent xss html/php? 7 answers i know type of question not allowed, cannot find reply anywhere. is sql injection protection necessary if you're not using databases/mysql? if have basic mail service form in php sends things email need protect form? if you're not using database no, don't need protect against attacks exploit database queries. emails have whole set of exploits of own , recommend using library such phpmailer or swiftmailer help this. either way, should verify info submitted form in format expect be. php security email code-injection

flash - loadmovie into _level0, all others _levels will reset? -

flash - loadmovie into _level0, all others _levels will reset? - i have simple swf file, load 3 film movie(swf) in 3 different _level : loadmovienum("test1.swf", 0); loadmovienum("test2.swf", 1); loadmovienum("test3.swf", 2); test2.swf have button script : on (release) { loadmovienum("test2.swf",0); } test3.swf have button script : on (release) { loadmovienum("test3.swf",1); } the problem when press test3.swf's button,it load test3.swf _level1 ,others _level still remain,but when press test2.swf's button load test2.swf _level0 ,and others _level dissappear. why? yes, loading level 0 replaces contents of main swf loaded swf. start @ level 1 , golden. flash actionscript-2

iphone - Consuming a WCF Service with Monotouch via SSL (https) + basicHttpBinding -

iphone - Consuming a WCF Service with Monotouch via SSL (https) + basicHttpBinding - i'm writing iphone app consume wcf services on secure connection (ssl/https). have managed consume service while testing locally via http. now want create sure service secure, we've set uat server signed certificate run our tests. we using custom binding, coupled security mode transportwithmessagecredentials requires username/password in clientcredentials property. generated proxy using sisvcutil.exe when seek phone call secure service iphone, rather lovely generic error of: exception in async operation: system.net.webexception: there error on processing web request: status code 500(internal server error) (here pastebin of total exception ). i've tried implicitly accepting certificate using: servicepointmanager.servercertificatevalidationcallback = (sender, cert, chain, ssl) => true; returns same 500 error. the same code works great on windows machine not on i...

MySQL: creating a new user/trying to access the database -

MySQL: creating a new user/trying to access the database - my problem is: had created new user: grant privilages on sampdb.* 'monty'@'' identified 'pass' user had appiared in 2 databases: mysql.user(with no privilages @ all) , mysql.db(with privilages except grant one). ok. after tried access sampdb database new user: mysql -u monty -ppass sampdb . mysql answered: "access denied user 'monty'@'localhost (using password: yes)'. please, tell me, did mistake? i think need grant privileges 'monty'@'localhost' , rather 'monty'@'' . @ moment, you're trying connect via localhost, , 'monty'@'localhost' doesn't exist. edit: or 'monty'@'%' , allow connections host. mysql mysql-error-1045

Calling an excel function from oracle forms -

Calling an excel function from oracle forms - can suggest how can utilize ole2 perform excel function (e.g. pmt()), oracle forms , result?? i recreate pmt function in pl/sql, native language of forms. e.g. based on http://forums.contractoruk.com/technical/28716-calculate-apr-loan-repayment-using-pl-sql-java.html: create function pmt (rate in number /* rate (apr) */ ,amt in number /* loan amount */ ,payments in number /* number of payments */ ) homecoming number /* periodic payment amount */ begin homecoming (rate/12*amt*power((1+rate/12),payments))/(power((1+rate/12),payments)-1); end pmt; e.g. begin dbms_output.put_line( 'pmt = $' || trunc( pmt(0.249, 5000, 11), 2) ); end; / pmt = $513.07 oracle excel oracleforms

python - Notepad++ Formatting Issue -

python - Notepad++ Formatting Issue - i have issue, working on jython project while editing notepad++. i'm having issue save file, open in normal notepad.exe , file comes out different how edited on notepad++. seems wherever pressed come in new line, notepad++ formatted have few spaces , whole 150+ line code word wrapped around 5 lines of carriage returns. any thought how can prepare this? figure it's in settings don't know how google , don't want seek every alternative until works notepad++ quite feature rich! found out myself! edit > eol conversion > windows format me! no, wait, credit goes to: this guy. python formatting notepad++ jython carriage-return

visual studio 2013 - Duplicate intellisense window for SCSS (VS2013) -

visual studio 2013 - Duplicate intellisense window for SCSS (VS2013) - when seek edit scss files 2 intellisense drop downs while i'm typing. using mindscape on other computers no problems, reason can't work on laptop. have no thought how prepare this. can help me? visual studio 2013 update 4 mindscape web workbench v3.4.1837 visual-studio-2013 intellisense mindscape

polymorphism - C++ Calling a child class function from a base class when I don't know the childs' type -

polymorphism - C++ Calling a child class function from a base class when I don't know the childs' type - i have inventory stores 'inventoryitem's. struct inventoryitem{ item* item; unsigned int quantity;}; std::vector<inventoryitem> m_items; i add together items following, m_inventory.additem(bandage); but when seek phone call bandages's use() function has been derived item base of operations class, calls item class use() funtion instead. it has been declared in item class so, // .... public: // .... virtual void use(player&){} // .... it has been declared in bandage class so, // .... class bandage : public item{ public: // .... virtual void use(player&); // .... it has been defined in bandage class so, void bandage::use(player& player) { player.heal(35); } when effort phone call use() function of item, instance, m_items.at(i).item->use(*m_player); it calls base of oper...

c++ - Statically link the libcurl library to my project (a dll) in Visual Studio 2013 -

c++ - Statically link the libcurl library to my project (a dll) in Visual Studio 2013 - so i've been trying statically link libcurl library project past day , i'm literally pulling hair out. everywhere on net different instructions given , none seem work. i've never statically liked library before have (for sake of keeping things organized). so project .dll file, requires libcurl library function. i've managed build libcurl.lib file libcurl source, have no thought need properties of dll project. i've tried adding "additional library directories", "additional include directories", "additional dependencies" without success. configurations seem work, in end still doesn't link statically, dynamically. oh, , i'm using visual studio 2013. does have experience statically linking libcurl? help much appreciated. thanks! after lot of experimenting figured out: had (for else experiencing these issues): open properties ...

CSS letter cut off. How to display entire text? -

CSS letter cut off. How to display entire text? - i have problem text in header. utilize google fonts (pinyon script) , 1 of letters cutting off. don't understand why... tried overflow properties doesn't work. problem header in pinkish on www.x4v1.com/cecile/ when screen width between 935 , 970 pixel. first l of sec word cutting off , show text. help me please ? thanking in advance. on chrome : you're doing wrong way around. font using getting out of it's inherited size (line-height, letter-spacing , on). hence should give h1 element big size, , span element smaller size. to prepare following: <h1 id="myheader"> c<span class="lowerfont">écile</span> l<span class="lowerfont">astchenko</span> </h1> than add together next css #myheader { font-size: 6em; } .lowerfont { font-size: .75em; } css text