Posts

Passing data between PHP and JavaScript? -

the overall idea drawing graph of somebody's scores in div. i've got button when clicked runs graph drawing function. have function retrieves data database using switch statement function shared other buttons. my data retrieval function: var getdata = function(button_id) { $.ajax({ type: "post", url: "../scripts/getdata.php", datatype: "html", data: {id: button_id}, success: function(result){ $("#profilebox").html(result); } }); }; runs getdata.php , returns values blank div. getdata.php: <?php session_start(); $switchcase = $_post['id']; $email = $_session['user']['email']; //connect database here $result=mysqli_query($con,"select * users email = '$email'"); switch ($switchcase) { case "profile_home": while($row = mysqli_fetch_array($result)) { echo $row['username'] . "...

fonts - Android : Proper way to use custom typeface in -

what right way use typeface in android? see many examples using custom xml tag text view. tried to set in java normal text view , works fine, reason use custom fields? when using custom typeface best add typeface /assets directory in project. lightweight following: textview customtypefacetextview = (textview) findviewbyid(r.id.customtypefacetextview); typeface customtypeface = typeface.createfromasset(getassets(), "custom_typeface.ttf"); customtypefacetextview.settypeface(customtypeface); just remember finding assets related current context if using custom fonts in fragment vs. activity want call getactivity().getassets() instead of getassets() . this reference quick tip : http://code.tutsplus.com/tutorials/customize-android-fonts--mobile-1601 additionally may more practical create class extends textview have more practical implementation custom font can used textview s want add custom font so: public class customtitletextview extends textview { pri...

java - Undefined for type ArrayList - putting random object of arraylist into variable -

i attempting place randomly chosen object of arraylist variable in class constructor. public wordstoguess randomword() { int index = randomgenerator.nextint(words.size()); wordstoguess chosenword = words.get(index); return chosenword; } public model() throws ioexception { words = new arraylist<wordstoguess>(); chosenword = words.randomword(); randomgenerator = new random(); } i error saying "the method randomword() undefined type arraylist". have removed unnecessary code constructor. chosenword = words.randomword(); should read: chosenword = randomword(); randomword() not method of arraylist of class.

android - set actionbar icon height to match actionbar height -

Image
see problem here, grey checkbox leaves room top , bottom of action bar: styles.xml <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="customactionbartheme" parent="theme.base.appcompat.light"> <item name="android:windowcontentoverlay">@null</item> <item name="android:actionbuttonstyle">@style/actionbuttonstyle</item> </style> <!--<style name="actionbuttonstyle" parent="@android:style/widget.holo.light.actionbutton">--> <style name="actionbuttonstyle" > <item name="android:height">@dimen/abc_action_bar_default_height</item> <item name="android:layout_height">@dimen/abc_action_bar_default_height</item> </style> i set item so: getmenuinflater().inflate(r.menu.submit_action, menu); submit_action looks like: <menu xmlns:android="...

c# - MVC 4 Razor _Layout.cshtml use a HTML section for only one page -

i have scenario want specific content _layout.cshtml used 1 view "_layout.cshtml" looks this.. <div> //common part pages - 1 </div> <div> //only index page - want index page. //but don't know how specify condition. if(it index page) use section //i can't move section index page, //because have html content displayed on index page below section, i.e. common part-2. </div> <div> //common part pages - 2 </div> @renderbody() <div> //common part pages - 3 </div> my index.cshtml page should this.. <div> //common part pages - 1 </div> <div> //only index page </div> <div> //common part pages - 2 </div> //content specific index.cshtml <div> //common part pages - 3 </div> and other pages should this.. <div> //common part pages - 1 </div> <div> //common part pages - 2 </div> ...

jquery - slideDown() effect issue -

i’ve noticed slidedown() effect doesn’t work div navigationmain, notice how i’m using ul/li tags header menu in div navigationmain. notice how i’ve placed id name within a/hyperlink tags header nav portfolio/about/contact within li tags , in div navigationmain. i’ve tried using slidedown() effect id #about-link nav button in navigationmain div , suppose open hidden div called aboutlayout opens small section of div , closes immediately. reason slidedown() effect works div doesn’t include ul/li , a/hyperlink tags. within div i’ve placed id name in img tag , slidedown() effect works. possible slidedown() effect doesn’t work ul/li , a/hyperlink tags? jsfiddle: http://jsfiddle.net/tb8h5/17/ http://jsfiddle.net/tb8h5/17/embedded/result/ (the navigation menu portfolio/about/contact text isn't appearing on jsfiddle link, i’ve added background colour show navigation menu) html <div class="header"> <div class="container"> <div class="he...

c++ - Can you 'redeclare' a variable in a subclass? -

is possible declare member subclass of base classes member? e.g. class { int a; } class b : { int b; } class foo { *baz; } class bar : foo { b *baz; //how can not shadow baz, 'redeclare' b? } basically, bar have baz b , want 2 things: way of showing/enforcing , avoiding have cast baz everytime used in bar. intuition not possible, dont purport c++ expert. you cannot. can redeclare return type of virtual function. class foo { virtual *baz(); }; class bar : public foo { b *baz(); };