Posts

Showing posts from August, 2013

Are either the IPad or IPhone capable of OpenCL? -

with push towards multimedia enabled mobile devices seems logical way boost performance on these platforms, while keeping general purpose software power efficient. i've been interested in ipad hardware developement platform ui , data display / entry usage. curious of how processing capability device capable of. opencl make juicy hardware platform develop on, though licensing seems kinda stinks. opencl not yet part of ios. however, newer iphones, ipod touches, , ipad have gpus support opengl es 2.0. 2.0 lets create own programmable shaders run on gpu, let high-performance parallel calculations. while not elegant opencl, might able solve many of same problems. additionally, ios 4.0 brought accelerate framework gives access many common vector-based operations high-performance computing on cpu. see session 202 - accelerate framework iphone os in wwdc 2010 videos more on this.

ruby on rails - Add sub-task rake -

i'm using rails 4 , need add subtask seeding our database using demo data (for product demo's). want make subtask called rake db:seed:demo , how can this? i tried subtask using code, got error rake saying task not found. #!/usr/bin/env rake # add own tasks in files placed in lib/tasks ending in .rake, # example lib/tasks/capistrano.rake, , automatically available rake. require file.expand_path('../config/application', __file__) api::application.load_tasks task :demo => :seed end task :seed => :db use namespace directive: namespace :db namespace :seed task :demo end end end

php - Parse error: syntax error, unexpected 'mysql_select_db' (T_STRING), expecting ',' or ';' -

i have been looking problem dont know problem be. give error. (parse error: 14 line) <?php $conect = mysql_connect('localhost','root') or die('no se pudo conectar: ' . mysql_error());; $telefono = $_get["telefono"]; $empresa = $_get["empresa"]; $mensaje = $_get["mensaje"]; $codigo = $_get["codigo"]; $remitente = $_get["remitente"]; $tiempo = $_get["tiempo"]; $db = "test_david"; echo "telefono: ".$telefono." empresa: ".$empresa." mensaje: ".$mensaje." codigo: ".$codigo." remitente: ".$remitente." tiempo: ".$tiempo mysql_select_db($db,$conect) ; or die("no se pudo seleccionar la base de datos"); $update = "insert datos (telefono,empresa,mensaje,codigo,remitente,tiempo) values('".$telefono."','".$empresa."','".$mesaje."','".$codigo."',&

Responsive CSS square -

using css , not javascript, how make square based on minimum of window's width/height? i've seen various approaches, want responsive whether you're on typical laptop or mobile device. jquery can using math.min($(window).width(), $(window).height()) there's got way accomplish via css no? without text in div, can this: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <style> div {width: 20%; padding-bottom: 20%; background: #f97e76;} </style> </head> <body> <div></div> </body> </html> it's useful if, say, creating gallery, can apply background images boxes. it's not use layout tool text containers, though. you put text in (although overflow @ small sizes): <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <style> .outer {width: 20%; padding-bottom: 20%; background: #f

windows - Computer is loading old website but its not a caching issue -

ok had domain switch hosts today , going fine except few minor things know how fix. there 1 issue have not come across before. 1 computer not loading new website. loading old 1 still. know thinking, caching issue. nope, doesn't seem so. erased cache on chrome , refreshed , still loads old site. so whipped out laptop, , re-tested , sure enough new site live. here things interesting, pinged site laptop , got correct ip address , such. did on other computer , getting different ip address. so thought, ok there in hosts file forcing point old website didn't see in file looked unusual. computer running windows 8 , hosts file checked located in c:/windows/system32/drivers/etc/hosts i don't know else check. guesses? thanks you're seeing cached ip address dns. run ipconfig /flushdns , , go chrome://net-internals , flush dns cache.

javascript - Showing all divs/elements under parent -

i have javascript function hides divs (and of elements within). after, "show" javascript function called want show 1 section of page , children divs under it. for example, have: <div id="synchronize" style="display:none;"> <ul class="bxslider"> <li> <h4>header</h4> <p>text</p> <p>more text.</p> </li> <li>hello </li> </ul> </div> when bxslider used, there several more divs added mix once javascript called. here javascript: var theid="synchronize"; //(this value passed in) div = document.getelementbyid(theid); div.style.display = 'block'; $('div#synchronize').children('div').each(function () { alert(this.value); }); the alert giving "undefined". seems should easy, can't figure out. thanks in advance. .value refer form field element, not dom element. m

wordpress function files, how to loop require_once? -

i trying loop through require_once statements in wordpress functions.php file this // initial theme setup require_once locate_template('/inc/init.php'); // register widget areas require_once locate_template('/inc/sidebar.php'); ... why following loop not working? $theme_includes = array( '/inc/init.php', // initial theme setup '/inc/sidebar.php', // register widget areas '/inc/scripts.php', // register scripts , stylesheets '/inc/nav.php', // main navigation '/inc/cleanup.php', // cleanup '/inc/customizer.php', '/inc/template-tags.php', // custom template tags '/inc/extras.php', // no theme functions '/inc/analytics.php' // google analytics ); foreach ( $theme_includes $include ) { require_once locate_template( $include ); } i no error message files not load if check the wordpress codex of locate_template() find function takes 3 parameters: locate_temp

How to catch assignment of unallocated variable. Visual studio 2010 (intel fortran compiler 2011) miss it -

i again struggling find mistakes in code visual studio under windows. assignment of unallocated allocatable variable variable messing code , visual studio never detected error. lost 2 days find it. tool can use can catch errors this? see there many alternative valgrind windows ( is there valgrind substitute windows? ), 1 suggest these kinda problems? thanks. when debugging or testing, compile , run appropriate error checking , diagnostic options (in project properties under fortran > diagnostics set compile time diagnostics "show (/warn:all)" , under fortran > "run-time" set runtime error checking "all (/check:all)". as observation - intel fortran compiler sold in bundle intel product (inspector xe) allows more intensive memory , concurrency correctness checking. runtime mode of has similar capabilities valgrind.

linux - Sudo error message -

i trying fix permission issues on debian server. on team of mine changing permissions around, , somewhere in process, things got screwed up. whenever sudo now, error message/warning: sudo: /var/lib/sudo writable non-owner (040720), should mode 0700 i'm confused number in parenthesis. mean? also, command run set such permissions? how should these permissions set? the /var/lib/sudo permissions are: drwx-w---- 5 root sudo 4096 feb 4 02:36 sudo which understand mean: directory read write executable root, , writeable sudo group, , no privileges rest of users. correct? the last 3 digits of permission mode owner, group, , other users respectively, , sum of following values: 4 read (r) 2 write (w) 1 execute (x) so if /var/lib/subo ***720, means: owner permissions = 7 = 4 + 2 + 1 = read + write + execute group permissions = 2 = write other permissions = 0 = no permissions. so yes, correct in interpretation of line of output. file mode changed

Unity meta files screw up facebook android builds -

i had posted this, found workaround , marked answered: facebook unity sdk android barfs when project connected asset server but came project 3 months later, got brand spanking new facebook sdk has many solid changes, , it's still problem. come on guys, there must "--ignore-assets" compile option can included ignore .meta files, no? pretty please fix :)

algorithm - adding a number to a list within a function OCaml -

here have , error getting sadly error: function has type 'a * 'a list -> 'a list applied many arguments; maybe forgot `;'. why case? plan on passing 2 lists deleteduplicates function, sorted list, , empty list, , expect duplicates removed in list r, returned once original list reaches [] condition. will updated code let myfunc_caml_way arg0 arg1 = ... rather let myfunc_java_way(arg0, arg1) = ... can call function in way: myfunc_caml_way "10" 123 rather myfunc_java_way("10, 123) i don't know how useful might be, here code want, written in standard ocaml style. spend time making sure understand how , why works. maybe should start simpler ( eg how sum elements of list of integers ?). actually, should start ocaml tutorial, reading , making sure aunderstand code examples. let deleteduplicates u = (* u : sorted list v : result far last : last element read u *) let rec aux u v last = match u

mysql - PHP or SQL issue -

i'm having strange issue php code. code. $c=mysqli_connect('localhost','root','*************'); $a=0; if($b=mysqli_num_rows(mysqli_query($c,$z="select count(*) `information_schema`.`tables` `table_schema` = 'wallets' , `table_name` = '".$_session['uname']."'"))!=0) { print("<b>wallet found</b>$b - $z"); $a=1; } if(!$a) { print("<b>no accounts found :(</b>"); } ?> this code returns this wallet found1 - select count(*) `information_schema`.`tables` `table_schema` = 'wallets' , `table_name` = 'shadowri5ing' it should return this no accounts found :( i enter same query in phpmyadmin , returns this count(*) 0 please me fix php code! thank :) edit: issue solved doing this... $q=mysqli_query($c,$z="select count(*) `information_schema`.`tables` `table_schema` = 'wallets' , `table_name` = '".$_session['unam

c++ - memcpy underlying data from std::vector of objects -

is safe or happen work on current compiler? there in standard? result in floats vector correct. class color { public: color(float r, float g, float b, float a) : mcolor{r,g,b,a} {}; inline const float *data() const { return mcolor; } private: enum {vectorsize = 4}; float mcolor[vectorsize]; }; //test std::vector<color> colors(2); std::vector<float> floats(8); colors[0] = color(0.1, 0.2, 0.3, 0.4); colors[1] = color(0.5, 0.6, 0.7, 0.8); memcpy(floats.data(), colors.data(), 8 * sizeof(float)); it's guaranteed work from standard 23.3.6.1 class template vector overview a vector sequence container supports random access iterators. in addition, supports (amortized) constant time insert , erase operations @ end; insert , erase in middle take linear time. storage management handled automatically, though hints can given improve efficiency. elements of vector stored contiguously, meaning if v vector t type other bool, obeys identity

visual c++ - Understanding Abstraction in C++ -

coming java c++ i'm attempting understand abstraction through object orientation. to put practical example, developing small game using sfml library graphics. question not relate that, think of background info. anyway, way game works process through number of different states. in case 2: the menu state: menu of game drawn , game begin here. the game state: state controls game, update entities , draw them. in order have created following classes: gamestatemanager.h #ifndef gamestatemanager_h #define gamestatemanager_h #include <sfml/graphics.hpp> #include <iostream> #include "gamestate.h" class gamestatemanager { public: // constructor gamestatemanager(); // state variables static const int numgamestates = 2; static const int menustate = 0; static const int gamestate = 1; // public functions void set_state(int state); void update(); void draw(sf::renderwindow &win); void input(sf::event event);

Check a PHP file for syntax errors -

i'm attempting build auditing feature application check various code quality issues. one of things check php files syntax errors. going use php_check_syntax() has been removed in php 5.0.5. i've tried using exec() statements isn't outputting anything. i've added date make sure exec() working: <?php error_reporting(e_all | e_notice | e_strict | e_warning); ini_set('display_errors', 1); $output = 'before'; var_dump($output); var_dump(exec('php -l ' . __file__, $output)); var_dump($output); var_dump(exec('date', $output)); var_dump($output); output: string 'before' (length=6) string '' (length=0) array (size=0) empty string 'thu feb 6 10:42:35 pst 2014' (length=28) array (size=1) 0 => string 'thu feb 6 10:42:35 pst 2014' (length=28) how can check php file syntax errors in php? check web-server configuration. places this: disable_functions="". after var_du

Android SMS show contact name by recipient_ids -

the code snippet below returns basic sms conversation data: cursor cursor = activity.getcontentresolver().query(uri.parse( "content://mms-sms/conversations?simple=true"), null, null, null, "normalized_date desc" ); if(cursor.movetofirst()) string recipient_ids = cursor.getstring(3); my question how can phone's contact data given recipient_ids? in case need retrieve contact number , contact display_name. your appreciated. in advance! try this: public string getcontactdata(string id){ string number; cursor phones = fa.getcontentresolver().query(contactscontract.commondatakinds.phone.content_uri, null, contactscontract.commondatakinds.phone.contact_id +" = "+ id, null, null); if(phones.movetofirst()) { number = phones.getstring(phones.getcolumnindex(contactscontract.commondatakinds.phone.number)); } phones.close(); return number; } hope helps!

java - Grails XML marshalling: change default "<list>" root element name -

by default grails renders list in xml <list> element tag @ root. likewise renders map <map> . control name of root element. if i'm returning arraylist of user, i'd see: <users> <user>...</user> <user>...</user> </users> how can achieve above? here requirements: easy apply serialization 50+ domain classes abstracted developers no explicit coding required during rendering domain objects (i.e., when render() or respond() invoked, arraylist still passed in, no explicit casting/converting as mynewtype ) able handle edge case of empty list (should return <users/> ) nice-to-haves: if formula can applied map well, great :) i have been semi-successful in achieving goals above, except don't know how account empty list case. implemented own objectmarshaller renders objects of type list . long list contains 1 element, can check element's type , determine plural tag name should (user => users

javascript - Autosave with angular $resource -

i trying implement editor model lot of fields has autosave feature. the model json, loaded $resource , used directly in scope. mymodelresource = $resource(config.api4resource + 'models/:id', {id:'@_id'}); $scope.mymodel = mymodelresource.get({id: xxxx}); problem #1: actual autosave implementation. each text field doing: html: <input type="text" ng-model="mymodel.somefield" ng-blur="save()" ng-change="dirty()"> controller: $scope.dirty = function() { $scope.dirtyflag = true; console.log('marking dirty!'); }; $scope.save = function(force) { if (!$scope.dirtyflag && !force) { return; } $scope.dirtyflag = false; console.log('saving!'); $scope.mymodel.$save(); } the idea is, saving on each ng-change expensive, don't want hit server every letter user types. ng-change() marks "dirty" flag in controller, , when move away field ng

javascript - CSS div with text as mask -

Image
i trying achieve mask-type effect coloured div's large text in html. want masked text show parts of image behind div. however; instead of using background-clip property , background-image on div - hoping reveal ever underneath element (in case, image). have tried using svg images compound paths, proved difficult handle. there other way this? css? jquery plugin? based on this article applying text mask , canvas tag. <div id="bg"><canvas id="overlay" width="240" height="70"></canvas></div> <script> // handle our canvas var ctx = document.getelementbyid('overlay').getcontext("2d"); // choose font ctx.font = "bold 36px 'helvetica'"; // draw black rectangle ctx.fillstyle = "black"; ctx.fillrect(0,0,230,70); // punch out text! ctx.globalcompositeoperation = 'destination-out'; ctx.filltext("some text", 25, 50); </script> http:

for loop - Java index out of bound error -

i having issues index out of bounds in program. loop in method @ bottom supposed run through many times specified in flightseatingamount() method. keep getting error when running program test. 1 or 2 outputs before errors out , other times don't output, error. here code: import java.io.filenotfoundexception; import java.io.printwriter; public class ole1 { static string[] airports = {"lax", "msp", "far", "atl", "ord", "dfw", "den", "jfk", "sfo", "clt", "las", "phx", "iah", "mia", "pek", "can", "hnd", "hkg", "sin", "lhr", "cdg", "lgw", "muc", "fra", "edi"}; static final int numberofentries = 10000; static string[] firstnames = {"isis", "donnette", "reyes", "willis", "kathy", "

java - Running an .exe based off of a class' location -

i understand line of code runs .exe's based of specific set location runtime.getruntime().exec("c:/users/username/desktop/javaapp.exe").waitfor(); but need run application based off of location of class ran in i'm gonna go ahead , make answer question. i believe this you're looking for. for comment asking removal of 'file' part string assuming have string called path contains: "file:/c:/users/jon/test/foo/test.class" you can call path.substring(5), return string containing text "/c:/users/jon/test/foo/test.class". int represents index want start @ new string, can change need.

python - trying to reinstall python2.7 mac -

so created issues in python when trying install more versions of python (2.6, 3.3) try , pydev eclipse work. this caused issues (then) working version of python 2.7 now, have reinstalled python 2.7. terminal can type $python2.7 , get: $ python2.7 python 2.7.6 (v2.7.6:3a1db0d2747e, nov 10 2013, 00:42:54) [gcc 4.2.1 (apple inc. build 5666) (dot 3)] on darwin type "help", "copyright", "credits" or "license" more information. >>> import sys >>> sys.path ['', '/library/frameworks/python.framework/versions/2.7/lib/python27.zip', '/library/frameworks/python.framework/versions/2.7/lib/python2.7', '/library/frameworks/python.framework/versions/2.7/lib/python2.7/plat-darwin', '/library/frameworks/python.framework/versions/2.7/lib/python2.7/plat-mac', '/library/frameworks/python.framework/versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/li

html5 - Gaps on top of Div when placing lists in them -

i'm having weird issue when place list in div, causes huge gap @ top of div. causing , how can fix it? body { background-color:aliceblue; margin:0px 0px 0px 0px; padding:0px 0px 0px 0px; } #logosearch { background-color:lightgray; width:1024px; margin:0px 0px 0px 0px; padding:0px 0px 0px 0px; } #nav { background-color:lightblue; width:1024px; margin:0px 0px 0px 0px; padding:0px 0px 0px 0px; } http://jsfiddle.net/myvegancookbook/jp899/ without seeing code impossible tell, suspect have css rule placing top margin or padding on lists. have tried using firebug or site analyzer see css rules being applied? edit: yes, looks have margin on ul... add css: ul { margin: 0; } that's need cancel out margin/padding, don't need 0px each direction have in code. also, css resets, start @ known baseline don't run issues this... here's fiddle change made: http://jsfiddle.net/jp899/2/

c - Convert unix timestamp to date without system libs -

i building embedded project displays time retrieved gps module on display, display current date. have time unix time stamp , progject written in c. i looking way calculate current utc date timestamp, taking leap years account? remember, embedded project there no fpu, floating point math emulated, avoiding as possible performance required. edit after looking @ @r...'s code, decided have go writing myself , came following. void calcdate(struct tm *tm) { uint32_t seconds, minutes, hours, days, year, month; uint32_t dayofweek; seconds = gpsgetepoch(); /* calculate minutes */ minutes = seconds / 60; seconds -= minutes * 60; /* calculate hours */ hours = minutes / 60; minutes -= hours * 60; /* calculate days */ days = hours / 24; hours -= days * 24; /* unix time starts in 1970 on thursday */ year = 1970; dayofweek = 4; while(1) { bool leapyear = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))

gcc - C++ recursion segfault. Can you help me see what I'm doing wrong? -

this first time i've used recursion other find factorial of number. i'm building program find words in boggle board. following function resulting in segfaults: void findword(vector<string>& board, set<string>& dictionary, string prefix, int row, int column){ prefix += gettile(board, row, column); if(prefix.length() > biggestwordlength) return; if(isoutofbounds(row, column)) return; if(isword(prefix, dictionary) == 1) foundwords.insert(prefix); if(isword(prefix, dictionary) == 0) return; //note: not prevent using same tile twice in word findword(board, dictionary, prefix, row-1, column-1); findword(board, dictionary, prefix, row-1, column); findword(board, dictionary, prefix, row-1, column+1); findword(board, dictionary, prefix, row, column-1); findword(board, dictionary, prefix, row, column+1); findword(board, dictionary, prefix, row+1, column-1); findword(board, dictionary, prefix, row+1, column);

iphone - iOS: Unwind back in a chain of modal segues -

i have user registration process separated out 3 screens. first screen has user enter mobile number, second screen asks him select location & third screen asks him enter birthday , few other details. so in total, there totally 3 controllers have used , presented in below order. 1) mobile_number_controller.rb 2) location_controller.rb 3)miscellaneous_details_controller.rb so present chain of controllers using modal segues result of discussion here . right kind of confused on unwinding back. questions have in mind 1) possible unwind controller in chain of presenting controllers not controller directly presented current controller, i.e miscellaneous_details_controller mobile_number_controller ? if possible right way so? 2) if 1) possible, happen other controllers in chain, i.e controllers between current controller , presenting controller in chain unwinding now, i.e, location_controller ? have manually dismiss controllers 1 one , do that? please suggest on rightful wa

c++ - I'm getting a error when I declare a class as a member of other class. error : a class-key must be used when declaring a friend -

i c++ rookie , experimenting boost serialization , wanted see if works when class declared member of class. when compile code loads of errors. tried declaring baseds struct no change in errors. code : #include <iostream> #include <fstream> #include <boost/archive/text_iarchive.hpp> #include <boost/archive/text_oarchive.hpp> class baseds{}; class superior{}; class baseds { private: friend class boost::serialization::access; public: int a; int b; int c; baseds(){} ~baseds(){} template <class archive> void serialize(archive & ar, const unsigned int version) { ar & a; ar & b; ar & c; } }; class superior { private: friend class boost::serialization::access; public: int x; int y; baseds lag; superior(){} ~superior(){} template <class archive> void serialize(archive & ar, const unsigned int version) { ar & x;

web services - Getting SOAPFaultException in Websphere 8.5.5.0 -

when trying call web-service on websphere 8.5.5.0 getting below exception.the same working in weblogic . caused by: javax.xml.ws.soap.soapfaultexception: internal error @ org.apache.axis2.jaxws.marshaller.impl.alt.methodmarshallerutils.createsystemexception(methodmarshallerutils.java:1353) @ org.apache.axis2.jaxws.marshaller.impl.alt.methodmarshallerutils.demarshalfaultresponse(methodmarshallerutils.java:1079) @ org.apache.axis2.jaxws.marshaller.impl.alt.doclitwrappedmethodmarshaller.demarshalfaultresponse(doclitwrappedmethodmarshaller.java:680) @ org.apache.axis2.jaxws.client.proxy.jaxwsproxyhandler.getfaultresponse(jaxwsproxyhandler.java:626) @ org.apache.axis2.jaxws.client.proxy.jaxwsproxyhandler.createresponse(jaxwsproxyhandler.java:566) @ org.apache.axis2.jaxws.client.proxy.jaxwsproxyhandler.invokeseimethod(jaxwsproxyhandler.java:432) @ org.apache.axis2.jaxws.client.proxy.jaxwsproxyhandler.invoke(jaxwsproxyhandler.java:213) @ com.sun.proxy.$proxy60.generatedocument(unknown

jQuery - Parsing JSON file based on mouse click -

this more of theory question rather specific programming problem. what i'm trying create world of tanks player "search engine" following steps: enter username of player parse json object of players similar names , append page based on name user clicks, clear page , populate json object specific player. i can generate url returns json file of player, i'm having trouble figuring out way render information page. here's jsfiddle of code. this function creates list of matching players , turns name link json file. $.getjson(searchurl, function(data){ $.each(data, function(key, value){ if(typeof value === 'object'){ for(var i=0; < data.count; i++){ var fullplayerurl = "<p class='entry'>" + "<a>" + key + "nickname - " + value + "</a>" + "</p>"; $('#results&#

Jagged array in java -

my final output should like: how many rows in jagged array? 4 enter row, separated spaces: 9 2 14 5 8 enter row, separated spaces: 3 enter row, separated spaces: 15 23 enter row, separated spaces: 9 8 7 6 5 4 3 after funky operation, resulting array is: 9 4 42 20 40 6 45 92 36 40 42 42 40 36 30 but keep getting errors: exception in thread "main" java.util.nosuchelementexception: no line found @ scannerhacked.nextline(scannerhacked.java:1525) @ jagged.main(jagged.java:14) here code: import java.util.scanner; public class jagged { public static void main(string[] args) { scanner sc = new scanner(system.in); system.out.print("how many rows in jagged array? "); int row = sc.nextint(); int[][] jaggedarray = new int[row][]; for(int = 0; < row; i++) { scanner rows = new scanner(system.in); system.out.print("enter row, separated spaces: ");

php - Strict standards: Non-static method CountryDetector::countryMatches() should not be called statically in -

i trying restrict countries , it's redirecting restricted country users perfectly. but, when user not restrict country, website loading following error message showing on top side of website. strict standards: non-static method countrydetector::countrymatches() should not called statically in c:\wamp\www\final\country\countrydetector.class.php on line 61 i calling class on index.php file this: <?php include('/country/countrydetector.class.php'); countrydetector::redirect("de", "http://google.com"); ?> and class library using is: <?php include("countrydetector.interface.php"); /** * class lookup's country code redirects (include files, or callbacks) user desired content want. * function of class google redirects users countries support google * e.g. in uk when enter google.com redirected google.co.uk , excatly * can countrydetector * * class builded in static context p

html - Optimizing background gif for mobile phones? -

so, have gif running, takes whole screen, background. how ever, when checked site on phone, whole screen wasn't filled , half way down black. http://goroam.org here's link, how make phones have gif takes whole screen,and text in middle if viewing site laptop? here solution.. making background-size: 100% 100%; make image full screen and make h1 responsive screen auto adjust screen.. here code: html { height: 100%; } body { color: #eeeeee; font: 24px/1.3 "arial"; min-height: 100%; background: url("http://media.giphy.com/media/13bggh9vnedsua/giphy.gif") no-repeat scroll 0 0 / 100% 100% #000000; height: auto; margin: 0; width: 100%; } h1 { color: #f0f0f0; font-family: "belta bold"; font-size: 212px; left: 0; margin: -120px 0 0; position: absolute; text-align: center; top: 50%; width: 100%; } if want perfect solution use css media queries.. here fiddle http:/

C++ Convert Ascii Int To Char To Int -

im able convert things without problem, google search if needed. cannot figure 1 out, though. i have char array like: char map[40] = {0,0,0,0,0,1,1,0,0,0,1,0,1... etc i trying convert char correct integer, no matter try, ascii value: 48/ 49. i've tried quite few different combinations of conversions , casts, cannot end 0 or 1, char. can me out this? thanks. the ascii range of characters representing integers 48 57 (for '0' '9'). should subtract base value 48 character integer value. char map[40] = {'0','0','0','0','0','1','1','0','0','0','1','0','1'...}; int integermap[40]; ( int = 0 ;i < 40; i++) { integermap[i] = map[i] - 48 ; // or //integermap[i] = map[i] - '0'; }

To integrate Mahout with already installed solr -

i have used solr index , search pdf files.. working fine. said use mahout project , told integrate solr. new technology please me scratch. in basic way.... need download , inmstall mahout first or modifications in schema , solrconfig make it? integrating tika functionality modification in config file. mahout separate project, have download, install, , learn how use it...will not 1 afternoon thing. but, should aware of this lucene clasiffication module (solr built on top of lucene). not complete mahout, not massive projects, can work well. advantage integrates lucene/solr, have less work do. have used sorl4.6

javascript - how to load style-sheet and java script and j query based on device -

in asp.net want load style-sheet , java script , j query based on device (desktop, tablet, mobile). based on device want inter change style-sheet , java script , j query detect user-agent in asp.net code , load appropriate stylesheets , scripts <% if(request.useragent.contains("android"){%> include android css here <%}else{%> include iphone css here <%}%>

javascript - AngularJS & Datatable - Compile html while re-rendering the cell value -

i using angularjs , datatable build grid. have following javascript code, demo: http://plnkr.co/edit/qj7vr1bec5odrrxphw2q?p=preview datatable_config = { "bjqueryui": true, "bprocessing": true, "bdeferrender": true, "sdom": "rlfrtip", "aadata": [null] }; angular.foreach(columns, function(column, key){ datatable_config.aocolumns.push({ "stitle": column.displayname, "mdata": function(source, type, value){ var cell_value = (source[column.field]) ? source[column.field] : '', rendered_cell; if(column.field == 'something'){ rendered_cell = $compile('<span>{{$root.value}}</span>')($scope); /* column, not getting span element evaluated rootscope instead, says [object object] */ } else { rendered_cell = cell_value; } re

c++ - Postincrementation operator in linked list -

i had write program handle main code:(not allowed change it) list<int> iv; iv["john"] = 23; int ia = iv["john"]++; int ib = iv["john"]; cout << ia << " " << ib << endl; // prints 23 24 try{ cout << iv["jack"] << endl; // should throw exception }catch(list<int>::uninitialized&) { cout << "uninitialized map element!" << endl; }; here code: #ifndef exam_h #define exam_h #include <iostream> #include <string> using namespace std; template <class type> class list { private: struct node { type value; string index; bool isinit; node *next; }; node *head; node *current; public: class cref { friend class list; list& s; string position; cref (list& ss, string pos): s(ss), position(pos) {}; public: operator type() const { return s.read(position); } cref& op

Dynamically add EditText, Spinner, Radiobutton in Android -

need add edittext, spinner , radiobutton based on array length. gquestionedittext = (edittext) findviewbyid(r.id.questioneditext); gquestionspinner = (spinner) findviewbyid(r.id.spinnerquestion); gquestionradiobutton = (radiobutton) findviewbyid(r.id.questionradiobutton); (int = 0; < subslotid.size(); i++) { } based on array size need add edittext,spinner , radio button, please suggest me add, , how differentiate id's , values. thanks try below code add dynamic views edittext, textview, spinner, radiobutton,.. layout based on size of array. sample code, not tested. linearlayout ll = new linearlayout(this); edittext edittext = new edittext(this); edittext.setid(edittext.generateviewid()); ll.addview(edittext); spinner dynamicspinner = new spinner(this); options = new arraylist<string>(); options.add("january"); options.add("february"); arrayadapter<string> adapter = new arrayadapter<strin

antlr4 - How to make an "global parser rule"? -

i'm building grammar parsing quake iii shaders antlr4. here's exemple of shader: textures/liquids/lava-example { deformvertexes wave sin 0 3 0 0.1 q3map_tesssize 64 surfaceparm lava qer_editorimage textures/common/lava.tga { map textures/common/lava.tga } } as can see, structure is: shadername { directive directive //.... { directive //... } } my question as can see, directive composed key , parameters. keys , parameters known (more 100 keys possible). wonder how set global rule directive (key + parameters) , specify of them beside of it. moreover, if can separate of them in different files keeping clean grammars, better. what have now parser grammar shaderparser; options { tokenvocab=shaderlexer; } shaderlist : shader+ ; shader : shadername lbracket directive* stage* rbracket ; shadername : path compiletime? ; stage : lbracket directive* rbracket ; d

jquery - On form submit add form values to table -

Image
i have following form in view: @using(ajax.beginform("addattendeeinternaladdressbook", "attendee", new ajaxoptions { httpmethod = "post", onsuccess = "doneinternaladdressbook" })) { @html.hiddenfor(m=>m.selectedaddressbookperson.firstname) @html.hiddenfor(m=>m.selectedaddressbookperson.lastname) @html.hiddenfor(m=>m.selectedaddressbookperson.appointmentid) <div class="form-group"> @html.labelfor(m => m.selectedaddressbookperson.email, new { @class = "col-md-2 control-label" }) <div class="col-md-8 input-group"> @html.textboxfor(m => m.selectedaddressbookperson.email, new { id = "selectedaddressbookperson", @class = "form-control", placeholder = "search in addressbook..." }) <input type='submit' id="btnaddressbook" class=&quo

How to edit Android Apps Content through Website ? -

is possible edit contents of android app through web site? example, contents in page (videos, texts) & layouts (location, size, colours). i think not possible directly sounds use wrong pattern. right pattern client-server one, android app client , website rest or other custom api server. application should request data server , display in way set up. edit data on server , app receive changes on request.

node.js - Scope of exported variable in express and jade -

i'm having few issues jade , scope of variables exported route. might obvious answer, googling abilities have failed me. in route, have code : res.render('index', {title: "app", csvdata: json // json object }; in view, want display length of json object on click of button. jade looks : extends layout block content script -var test123 = csvdata; -console.log(test123.length); div button.btncsv(onclick='console.log(test123)') save csv the first console.log prints correct length, when press button, tells me test123 undefined. think has difference between client side/server side variables. if case, there anyway make server side variable accessible client side scope? i'm not sure how example work script content prefixed -, indicates unbuffered code. javascript runs server side , produces no direct output, in-line script empty. similarly onclick handler compiling string on server, main problem

php - Execute wp_logout_url('/') in Javascript -

i want check javascript based on condition want log user out. how call php js? doing research find lots on info on how create logout link, trying execute inside js instead. something like: if(variable == 1) { execute logout no confirmation (in php function show link "<?php echo wp_logout_url('/redirect/url/goes/here') ?>") } else { else here; }; wouldn't setting location.href trick, url pre-rendered php? if( variable == 1 ) { window.location.href = '<?php echo wp_logout_url('/redirect/url/') ?>'; } else { //do else here; };

qt - qDebug() output is not visible on a terminal -

i use ubuntu 12.04 lts. when run console application using qt creator output of qdebug() not visible on terminal (i empty terminal cursor). how fix ? edit1 can't stop program using stop button, have use force quit option. edit2 here code: #include <qcoreapplication> #include <qdebug> int main(int argc, char *argv[]) { qcoreapplication a(argc, argv); qdebug()<<"ok"; return a.exec(); } edit3 solution: qt creator: run in terminal

javascript - Counting in binary -

i'm learning program , trying make program count in binary. i made function convert provided decimal binary , looks working ok, when try count upwards using loop browser freezes , can't understand why. using similar while loop produces result needed. the problem right @ bottom commented out. please figure out i'm doing wrong here. here's code: function isodd(num) {return num % 2}; var tobinary = function (number) { ints = []; binary = []; ints.push(math.floor(number)); while (number >= 1) { number = (math.floor(number))/2; ints.push(math.floor(number)); } (i=ints.length-1;i>=0;i--) { if (isodd(ints[i])) { binary.push(1); } else { binary.push(0); } } if (binary[0] === 0) { binary.splice(0,1); } return binary; }; var count = 0; while (count <= 50) { console.log(tobinary(count)); count++; } /* (i=1;i<=50;i++) { console.log(tobinary(i)); } */ use for (var i=ints.length-1;i&

apache - Cannot get a Koji Build system work -

i setup koji build environment in centos6 machine server suggested documentation ( http://fedoraproject.org/wiki/koji/serverhowto ). access koji web using http. yet facing ssl certificate trouble when switching https: client browser error produced mozilla firefox: ssl peer unable negotiate acceptable set of security parameters. (error code: ssl_error_handshake_failure_alert) having enabled 2 admin users, koji secific error when running command: su kojiman; koji call getloggedinuser errors under : kojiman: error: [('ssl routines', 'ssl3_get_server_certificate', 'certificate verify failed')] # su kojiadmin; koji call getloggedinuser errors under: kojiadmin error: [('ssl routines', 'ssl3_read_bytes', 'sslv3 alert bad certificate'), ('ssl routines', 'ssl3_write_bytes', 'ssl handshake failure')] while in httpd ssl log have following: ############################" ssl erros: [wed f