Posts

Showing posts from August, 2012

redirect - Redirecting HTTP to HTTPS with Apache -

i have issue using mod_rewrite force redirection of http requests https using apache 2.2.22 on ubuntu server 12.04. my /etc/apache2/sites-available/default file follows: <virtualhost *:80> rewriteengine on rewritecond %{server_port} !^443$ rewriterule ^/(.*) https://%{http_host}/$1 [nc,r,l] </virtualhost> the https host defined in default-ssl in same directory. visiting server's local ip address, redirect appears work fine. however, accessing via fqdn, doesn't. using fqdn, site available @ port 5443, mapped in firewall 443 on server, perhaps has problem. cannot use port 443 directly, in use on ip address server. to further clarify, following valid links: https://website:5443 https://192.168.200.80:443 the redirect works here: http://192.168.200.80 but following gives 400 bad request, , redirect needed: http://website:5443/ "your browser sent request server not understand. reason: you'

indexing - Please Help me to optimise mysql query containing subqueries for just a few hundred records -

table details--> create table `redeem_vouchers` ( `voucherid` int(11) not null, `voucheramount` decimal(18,2) default null, `redeemedto` int(11) default null, `redeemedon` datetime default null, `transid` varchar(100) default null, `paymentconfirmed` tinyint(1) not null default '0', `confirmedby` int(11) default null, `confirmedon` datetime default null, `redeemedby` int(11) default '0', primary key (`voucherid`), key `newindex2` (`redeemedto`), key `newindex3` (`voucheramount`), fulltext key `newindex1` (`transid`) ) engine=myisam default charset=latin1; query--> select distinct(transid), (select (count(voucheramount)*16) redeem_vouchers transid = r.transid) amount, (select redeemedto redeem_vouchers transid = r.transid limit 0,1) 'name' redeem_vouchers r confirmedon between ('2013-07-23 19:00:00') , ('2013-07-24 19:00:00') table contains 4909 rows , query taking 35 seconds retur

How to display an images instantly in Java Applet? -

i created simple memory game in java applet. have problem cards. images need load time during first appearance. how fix that? need show image instantly after card flip. i display loading screen until application isn't in appstates.ready or appstates.wait_for_start state dosen't help. memo.cs - main class images loading public class memo extends japplet { //... public void init() { //... try { swingutilities.invokeandwait(new runnable() { @override public void run() { creategui(); }}); } catch(exception e) { e.printstacktrace(); } } private void creategui() { final model model = new model(...); final view view = new view(model); getcontentpane().add(view, borderlayout.center); setbackground(backgroundcolor); setpreferredsize(new dimension(width, height)); model.setloading(loadimages(loadingpath, format, 1)); model.setcard

android - Invalid resource directory name (Eclipse) -

i trying read text .txt file in project directory in android. have file called "test.txt" in assets folder. text write in file causes compiler error: invalid resource directory name . why this? thought put files assets directory without problem. missing something, need declare assets in manifest or something? assets folder in root project folder, eg project/assets/test . however text write in file causes compiler error you can not write in assets @ runtime . assets folders don't exist on phone. they're compiled package. assets provides reading facility. if want write something, please use external directory or cache directory provided application. take @ storage options .

Sharepoint Foundation - Create page with zones -

i create page default left , right zone, i'm able create rich page column-based text layouts. how can achieve that? there kind of templates? setup: sharepoint foundation 2010 (without access sp designer) learned this question , i'm not able create custom layouts without designer. i have found looking for: all site content in quick launch bar create category pages , sites web part page now can choose default layout template multiple column combination. detailcode stated , i'm unable create own templates without sp designer

Ajax binding list based on the another list in MVC4/razor -

i have 2 list in same page, 1 category list , 1 event list. need ajax binding on event list when make category list item click. event list binding based on category item there not occur page refresh. note: have using ajax asp.net 4.5 mvc4.5 razor. please me. thanks!

intended c++ virtual function not getting called -

this code #include "stdafx.h"** class iplayback { public: virtual void createrenderstream() = 0; }; class icapture { public: virtual void createcapturestream() = 0; }; class iaudiostackinterface { public: virtual void createstream() = 0; }; class caudioclientinterface : public iaudiostackinterface, public icapture, public iplayback { void createcapturestream() { printf("\n in createcapturestream"); } void createrenderstream() { printf("\n in createrenderstream"); } void createstream() { printf("\n in createstream"); } }; typedef iaudiostackinterface* piaudiostackinterface; typedef icapture* pcapture; typedef iplayback* piplayback; typedef void* pvoid; int main() { pvoid pobj = new caudioclientinterface(); pipla

image - HTML Table Cell Width with Photo - Cross Browser -

i have following html code: trying show image , under image show text in table cell. example: <table bgcolor="yellow" cellspacing="0" cellpadding="0"> <tr> <td width="100%"> <img width="100%" src="http://eofdreams.com/data_images/dreams/cat/cat-01.jpg" border="0" style="vertical-align: top;"/> <br/> <div style="background-color: #023f7d"> <p>test</p> </div> </td> </tr> </table> the code above leaves yellow vertical stripe @ right of image. image not cover whole td. if put width="100%" in img tag problem yellow stripe appears under photo. happens in ie (in safari works fine). want show div under photo without space. what doing wrong ? the prob

javascript - PHP form processing -

i have html form has 2 textbox , text area. fetching data form using php code display on page. html form code: <html> <form name="addsg" method="post" action="validate.php"> <div class="label">name</div> <div class="response"><span><textarea class="textarea" name="name"></textarea></span></div> <div class="label">age</div> <div class="response"><span><input class="textbox" name="age" type="text" size="5" maxlength="5" value="" /></span></div> <div class="label">place</div> <div class="response"><span><input class="textbox" name="place" type="text" value="" /></span></div> <div class="submit_section button"&

c# - create a scheduler for asp.net web application. -

i have web application in asp.net 3.5 hosted in dedicated server environment. now have pages in website goes facebook,google , data , stores in db. problem have visit page data. 1 of friend told me create windows service can job me. dont want create windows service want page run in night(once day) retrieve data, stores db , send emails management guys. please suggest me how can achieve this. have searched online no luck. thanks time. the authors of stackoverflow used solution based on adding item cache, running scheduled code when cache item expired , ran callback method. here implementation: http://blog.stackoverflow.com/2008/07/easy-background-tasks-in-aspnet/ edit : when says "at startup", means in global.asax file, in event called application_start.

How can output result of multi select in Function of Postgresql? -

i have function as: create or replace function f_compare_data_extract(tm_id_1 integer,tm_subid_1 integer,tm_id_2 integer,tm_subid_2 integer ) returns integer $$ begin --select * a; --select * b; --select * c; return 0; end $$ language 'plpgsql' ; i want output result of 3 query when run function : select f_compare_data_extract(13,2967,13,2968); select * a; select * b; select * c; postgresql doesn't support returning multiple result sets single command. if selects a, b , c return data in same format, can union them together, return them 1 result set. if return data in different formats, can still union them together, you'll need add lots of nulls. alternatively, have function create , populate temporary tables. execute function , select temp tables in separate commands. as final option, return data encoded somehow, e.g. using row_to_json

php - Pressing enter in textarea field refresh the page -

i'm using symfony2 i'm experiencing troubling thing. i have form, textarea field, each time press 'enter' go next line refresh page (without deleting previous line).. do have idea come from? thanks! well sure have submit button on form. on enter in form call submit butt refreshes page! in order prevent can make button in type="button" , bind onclick function submit button not called on enter! however; remove enter feature calls submit on entire form not in text area! or --> can call function on keypres or keyup on text area , e.prevetndefault(); i hope answers helps you!

javascript - Caching elements in jQuery (Internet Explorer?) -

<script> var elem = null; $(document).ready(function() { $elem = $("#elem"); $("#parent").html(''); $("#parent").append($elem); }); </script> <div id="parent"> <div> bla bla bla... </div> <div id="elem"> <div> work's! </div> </div> </div> i want cache element id #elem als child nodes , text nodes , text nodes of child nodes. code above works in google chrome , firefox, in internet explorer (tested ie 10) child nodes of #elem missing. any help? in advance. alright, think jquery internal cloning/ coding issue -- deep copy vs shallow copy! using $elem = $('#elem').clone(); works !

Writing html in php -

hi want write html in php this but getting error. have seen manay example problem unsolved. parse error: syntax error, unexpected '}' in /home/a2277283/public_html/pages/home.php on line 12 my code <?php if (!isset($_session['email'])) {?> <h4>login</h4> <form action="scripts/login.php" method="post"id="login_form"> <strong>email:</strong><input type="text" name="user_email"/> <input type="submit" value="login" name="submit"/> </form> <?php}?> this works : <?php if(!isset($_session['email'])){ ?> <h4>login</h4> <form action="scripts/login.php" method="post"id="login_form"> <strong>email:</strong><input type="text" name="user_email"/> <inp

Dynamic URL rewrite with .htaccess -

migrating site iis apache , i'm having trouble rewriterule can't find answer to. i need redirect www.domain.com/pubs/books/p123.asp www.domain.com/books.php?p=p123 . no matter try, i'm getting 404. can give me pointer? examples seem find have dynamic part of url @ end. first need strip .asp? drupal running on site there rewriterules there to. the latest have tried is: rewriterule /pubs/books/p(.*)$.asp /books.php?p=$1 first of all: read documentation! can find here . it says: syntax: rewriterule pattern substitution [flags] and in virtualhost context, pattern matched against part of url after hostname , port, , before query string (e.g. "/app1/index.html"). in directory , htaccess context, pattern matched against filesystem path, after removing prefix led server current rewriterule (e.g. "app1/index.html" or "index.html" depending on directives defined). if wish match against h

javascript - converting array of array into array of keyvalue pairs -

i want convert array of array array of key-value pairs using javascript or jquery. i have array of array : var arrofarr = [[1,'one'],[2,'two'],[3,'three']]; how convert arrofarr array of key-value pairs looks like [{id:1,text:'one'},{id:2,text:'two'},{id:3,text:'three'}] var result = []; (var = 0, ilength = arrofarr.length; < ilength; i++) { result.push({ id: arrofarr[i][0], text: arrofarr[i][1] }); } console.log(result);

php - How to repeat months in loop ? -

i want insert dynamic months database if user select march need insert record 12 months march feburary. getting dynamic months when trying insert database insert first 12 months. need repeat loop again march february if user click on add more button. code : $months = array(); $date="august"; $year= '2014'; //$y= (int)$year; $currentmonth= date('m', strtotime($date)); $currentyear= date('y', strtotime('+1 year')); for($x = $currentmonth; $x < $currentmonth+12; $x++) { $months[] = date('f y', mktime(0, 0, $currentyear, $x,1)); } //print_r($months); for($i=0; $i<=23 ; $i++) { echo $insert= "insert month(month_name) values('".$months[$i]."')"; } as months array has 12 values, can't go value 23 in array. can run through array twice 0 11, this: for($j=0; $j<2 ; $j++) { for($i=0; $i<12 ; $i++) { echo $insert= "insert month(month_name) values('".$months

Jquery ui tabs "onLeave" event? -

i'm using jquery ui tabs build user interface. tabs contents loaded via ajax. i'm faced problem: when user select tab, content of previous selected tab must saved (via ajax) , don't see event "on leave current" tab (or this) trigger "save" function. edit: snipped code (how i`m build tabs): var id_p = "a value"; $( "#dialog-confirm" ).dialog({ show: { effect: 'drop', direction: "up"}, resizable: false, height:140, modal: true, buttons: { yes: function() { var dlg = $( ); url = "/product/edit.php?id="+id_p; $.post(url, function(data) { data = $.parsejson(data); loadurl = data.loadurl; title = data.title; tabindex = data.tabindex; $("#product_tabs").tabs("add",loadurl,title); $("#product_tabs").tabs("select"

mysql - PHP loop creating duplicate database rows -

i'm playing creating database contains plaintext , hash values combination of passwords, when added database end many duplicates before moves on next combination... ideas why , how stop it? <?php $con=mysqli_connect("localhost","root","","test"); // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } $numberof=0; $alphabet = array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"); for($i=0; $i<count($alphabet); $i++){ for($j=0; $j<count($alphabet); $j++){ for($k=0; $k<count($alphabet); $k++){ for($l=0; $l<count($alphabet)

python - How to extract a javascript variable using regular expression -

i need extract javascript variable containing multiline json remote page using python script(2.7), , want use regex this, pattern not return anything what doing wrong ? here's code : request = urllib2.request("http://somesite.com/affiliates/") result = urllib2.urlopen(request) affiliates = re.findall('#var affiliates = (.*?);\s*$#m', result.read()) print affiliates if @ docs re.findall(pattern, string, flags=0) , you'll see need change how you're using it affiliates = re.findall('var affiliates = (.*?);\s*$', result.read(), re.m) you might want consider how whitespace can sloppy in javascript .

vb.net - Set dataset defaultvalue dynamically -

on sql-server have stored procedure gives me dataset of logged in windowsuser: id,name, windowsusername, birthday, 1 dataset. wanna set windowsusername defaultvalue in vb.net dataset. tried find hint weather possible write command defaultvalue field couldnt find anything. reason: wanna have name filled in datagridview when create new row. problem: cannot set defaultvalue manually since value changes each user. how windowsusername default value in dataset? datacolumn.defaultvalue object type. cannot add commands sql column's default value , expect them executed. example, if set default column's value datetime.now() date/time point line of code executed used default values in data table. datetime.now() not re-evaluated each time row created , every row in table have same date/time assigned. you have assign desired windows username each row in table. http://msdn.microsoft.com/en-us/library/system.data.datacolumn.defaultvalue.aspx

Can we use Google Android in-App purchase in Android apps published on Samsung Store? -

i in process of publishing android game , released on samsung store. using android in app purchase system inside game, not sure if samsung allows using or require using samsung plasma purchase system ? for samsung app store need use plasma.... for more ref. visit http://developer.samsung.com/distribute/monetization http://developer.samsung.com/android/technical-docs/in-app-purchase-using-plasma-in-android this may you

android - Read-only file system -

i´m trying store png file in internal memory of phone, having lot of problems after try lot of diferent ways. i´m using code: private void storeimage(bitmap image, string nombre) { try { file file = new file(nombre+".png"); file.createnewfile(); fileoutputstream fos = new fileoutputstream(file); image.compress(bitmap.compressformat.png, 100, fos); fos.close(); } catch (filenotfoundexception e) { log.d(tag, "file not found: " + e.getmessage()); } catch (ioexception e) { log.d(tag, "error accessing file: " + e.getmessage()); } } but doesn´t work because logcat message: error accessing file: open failed: erofs (read-only file system) i don´t know how change permissions of file or if there better ways save png file in phone. thanks!! edit: since kitkat use of environment.getexternalstoragedirectory(); discouraged, in favor of context.getexternalfilesdir re

jQuery animate(), expand a div -

html: <div id="box0"><img src="http://s14.postimg.org/9x1nrefy5/a_sunday_on_la_grande_jatte.png" id="pic0"></div> <div id="box1"><img src="http://s14.postimg.org/hbqzjs1tp/starry_night.png" id="pic1"></div> <div id="box2"><img src=http://s14.postimg.org/x7ftn2se5/mona_lisa.png" id="pic2"></div> <div id="box3"><img src="http://s14.postimg.org/k4k73t265/the_scream.png" id="pic3"></div> css: * { padding: 0px; margin: 0px; z-index: 0; } img { position: relative; } div { position: absolute; overflow: hidden; border: 8px solid #61260d; } #box0 { /* sunday on la grande jatte */ height: 150px; width: 120px; top: 300px;

sql - mysql: getting a count of all the data, daily, for the last 365 days -

every day, table in mysql db(db.table1) gets data written it. gets anywhere between 9000 30000 rows per day. has been happening daily last 3 years. there way (perhaps kind of count(*) command) count of how many rows have been written db every day last 365 days. edit: have firstcreated date looks this(2011-08-02 15:01:21) every entry it this: > 2012-01-01 | 3998 > 2012-01-02 | 8798 > 2012-01-03 | 12000 > 2012-01-04 | 398 > 2012-01-05 | 2876 until 2012-12-31 | 5788 thanks much! select count(*) totalrows, date_formate("%y-%m-%d",firstcreated) firstdate table_name date_formate("%y-%m-%d",firstcreated) in ("2012-01-01" , "2012-12-31") group firstcreated; use above query.

Python and MySQL mysterious memory leak -

i'm running python app that's querying (selecting) mysql db, reading ~1k rows @ time, performing calculations them , repeating hours. table read have ~20m readings , it's powered myisam engine. mysqldb connector used access mysql python. problem after few hours server's memory used, leaving server 16mb memory available. first idea memory leak in python app, memory_profiler , dozer/dowser both showed variables released properly. next try catch leaker taking process memory usage snapshot (ps vax | sort -k8n) before , after memory exhaustion. snapshot (sorted mem) when server had 280mb free (info top): http://pastebin.com/0f3wht0s 2 hours later... snapshot hen server had 18mb free (info top): http://pastebin.com/9mjklx2g my surprise memory consumption of mysqld , statcalculator processes seams identical through time. i'm missing related memory allocation in linux. how see process allocated memory? server running ubuntu server 10.04, , has 1gb ram in

android - How to make all content in a linear layout be one clickable item -

i want make link in android linear layout main view. within there horizontal linear layout each row, in each row there image , description , price , id(wont displayed). once have list off items want user able click on row , action. how can this? have tried settings clickable=true on linearlayout: here xml code: <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:clickable="true" android:focusable="true" android:focusableintouchmode="true" android:onclick="menuitemselected" > <imageview android:id="@+id/imageview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/burger" /> <textview android:id="@+id/edittext1" android:layout_width="0dp" android:layout_height="

jQuery scrollTo code assistance -

can please explain why won't work? ideally, when link @ top clicked, should scroll down other class. don't understand lot of code, detailed explanation great! $('a.scrollto').click(function(){ $('html, body').animate({ scrolltop: $( $.attr(this, 'href') ).offset().top-25 }, 500); return false; }); you have make sure each anchor class "scrollto" has href points class (or id more suggested). example: <a href="#gotothisanchor" class="scrollto">scroll #gotothisanchor</a> clicking above anchor scroll down element has id="gotothisanchor //put's click event listeners on anchor elements class name 'scrollto' $('a.scrollto').click(function(){ $('html, body').animate({ //animates html , body (this makes scroll effect) scrolltop: $( $.attr(this, 'href') ).offset().top-25 //choose element scroll in case cho

html5 - create login validation dateofbirth as input type -

can 1 suggest how can create login validation alphanumeric characters input field. trying use type of input tag, can use numbers input . input type="number" name="roll number" placeholder="roll number" how can define input field alphanumeric input fields? example- rno52 if want can create input type of text , write pattern has match in order pass validation. <input type="text" pattern="[a-za-z]{2}\d{3}" title="xx999" placeholder="xx999" />

php - Display FPDF report in a div from a jquery-fancybox -

i have fpdf report generator available pdf download report generated dynamically. trying display report on screen through jquery-fancybox, problem instead of being displayed report, showing special characters such as: "��w�b 2��(ʷ���:��uc��\". i need of of you. below functions generating , display fancybox , pdf. show fancybox , ajax-request call function generating pdf: $(function() { $("*").on("click", ".fancypdf", function() { var data = $("form").serialize(); var url = this.value; $.fancybox.open({ type: "ajax", ajax: { datatype:"html", type: "post", url: url, data: data }, href: url, beforeclose: function(){ $(".fancybox-inner").unwrap(); } }); return false; }); //click }); run fpdf report: function exibirrelatoriopdf($dados = '') {

jboss7.x - List exposed OSGi services in JBoss AS 7.2 Management Console -

i'm running jboss 7.2 (in standalone mode) , i've imported couple of bundles. when in management console on http://localhost:9990 , , go runtime operations -> osgi , bundles listed active, , output in terminal i'm running jboss shows status messages started ok. however, i'm having trouble accessing services should exposed these bundles. in order find out if configuration of bundles problem, or client code, i'd jboss list services exposed/provided given bundle, can match against expectations. is possbile? where, , how? not specific jboss, why don't try out xray , peter kriens. excellent! requires aache felix web console . web console might enough, visualization provided xray hard beat.

Acrobat's Javascript console is not working -

moving indesign acrobat now, need automate simple task. i'll use bridgetalk have indesign script call acrobat x , have couple of simple things. end i've been reading on how script acrobat. unfortunately, not seem anywhere simple scripting indesign or illustrator. for 1 thing, extendscript toolkit useless since acrobat has built-in "javascript console". fine, except console seems broken. once launched (and hellacious trying figure that out), type in simple 3 + 4 in console , press command+enter , noted in thom parker's guide on acrobatusers . (i don't have fancy mac extended keyboard numeric keypad, have use command+enter .) nothing happens. i've tried other things, such selecting code first, pressing control+enter instead, using different line of code such console.println("hello."); , etc. nothing seems work. doing wrong? finally got question answered on over adobe's forums . thought had tried everything, turns

html - PHP not executing -

so im still beginning learn php , im trying make code upload 2 items,name , age. database "nk" table "players" , display entries in players. whenever hit submit, page reloads show php code , doesn't execute. <html> <body> <form action="db.php" method="post"> name: <input type="text" name="name"> age:<input type="text" name="age"> <input type="submit"> </form> </body> </html> and db.php file <?php mysql_connect("localhost","noha","noha"); @mysql_select_db(nk) or die( "unable select database"); $name=$_post['name']; $age=$_post['age']; $result=mysql_query("select * players"); $num=mysql_numrows($result); mysql_close(); echo "<b><center>database output</center></b><br><br>"; $i=0; while ($i < $num)

css3 - alternative to calc() for css background positioning in android browser and chrome for android -

here´s problem: i need possition background image 0.3em left right edge background-position: calc(100% - 0.3em) 0.3em; now, problem works on browser except android native browser , chrome android do know other way in can solved using css only? thanks in advance modern browsers understand background positioning right edge. i'm not sure if works on android give try: background-position: right 0.3em top 0.3em; this sets position 0.3em top , 0.3em right edge. please note not work in older browsers need provide fallback.

mysql - PHP Update Table Error -

i've developed code update field in mysql database it's not working @ all. here code: $note = mysqli_real_escape_string($con, $_request["note"]); $read_note_sql = "update notes set read = 'y' id = '$note'"; $read_note_res = mysqli_query($con, $read_note_sql) or die(mysqli_error()); if(mysqli_affected_rows($con)>0){ echo "1"; } else { echo "0"; } this echoing 0 , showing error "mysqli_error() expects 1 parameter, 0 given in" can please advise solution here? thanks see if works: $note = mysqli_real_escape_string($con, $_request['note']); $read_note_sql = "update notes set read = 'y' id = '$note'"; if (!mysqli_query($con, $read_note_sql)) { printf("errormessage: %s\n", mysqli_error($con)); } else { // printf("affected rows (update): %d\n", mysqli_affected_rows($con)); if(mysqli_affected_rows($con)>0){ ech

xml - C# Adding a root to an XDocument -

i have string contains xml, lets this: <novels> <book> <title>cat in hat</title> <price>12</price> </book> </novels> i want make xdocument looks this: <booklist> <novels> <book> <title>cat in hat</title> <price>12</price> </book> </novels> </booklist> i can load xml string xdocument using xdocument doc = xdocument.parse(xmlstring); how load document under new root. can think of creating new xdocument root want , using loop add nodes children, there easier way of doing this? xdocument yourresult = new xdocument(new xelement("booklist", doc.root));

jQuery-Validation-Engine wrong position popup on field hidden (jquery tabs) -

i use jquery-validation-engine validate form, i've problem .... i've form in div divided tabs , set validationengine this: $(".test").validationengine({validatenonvisiblefields: true}); on submit works fine both on fields in active tab in non-active .... popup error of fields in non-active tab not aligned corresponding field. the _calculateposition function seems ignore real coordinates of field-hidden check... any suggestion? thanks much i have solved same problem using validationengine updatepromptsposition method each tab... this: $(".tabs-1").click(function(){ $form.find('form').validationengine('updatepromptsposition'); });

css - Animating Elements Inside Bootstrap Carousel -

can give me example on how animate css3, elements inside of typical bootstrap carousel? i going effect (bsstc.com.au). know it's different type of slider, animations inside of after. i know there class of (.active) added item current in slider when this: .slide-one .item-one { -webkit-transition: .6s ease-in 0s; -moz-transition: .6s ease-in 0s; -ms-transition: .6s ease-in 0s; -o-transition: .6s ease-in 0s; transition: .6s ease-in 0s; margin:100px 0 0 0; } .slide-one.active .item-one {margin:0;} it works in chrome , nothing else. there better way or different way missing? here html... <div id="carousel-1" class="carousel slide carousel-fade hidden-phone"> <ol class="carousel-indicators"> <li data-target="#carousel-1" data-slide-to="0" class="active"></li> <li data-target="#carousel-1" data-slide-to="1"></li> <li data-t

php - Warning: Cannot modify header information - headers already sent by (output) -

this question has answer here: how fix “headers sent” error in php 11 answers i'm getting error again , again try can't found solution warning: cannot modify header information - headers sent (output started @ /home/xxxx/xxxx/forum/index.php:90) in /home/pappu/public_html/forum/index.php on line 93 here index.php code <?php include_once("connect.php"); session_start(); ?> <html> <head> <title>myforum</title> <style type="text/css"> body { background-color: #333; margin-top: 150px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; } .content { background-color: #666; width: 960px; margin-right: auto; margin-left: auto; border-radius: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px; padding: 20px; } .content .categories { width: 700px; background-color: #333; border-radius: 3px; -webki

oop - Alternate implementation of design Pattern in PHP -

Image
this question might obvious people , solution might simple well. save hours of time. i working on project have seen model structure shown in diagram below. in design structure have simplerow , advancerow classes. these 2 classes implement row interface , extend rowabstract class , rowabstract class composites masterrow class. this design seems similar strategy pattern to. my question here design pattern this? kind of variation of strategy pattern? or practice , not design pattern? thanks help. the diagram here drawn reference might contain errors. please ignore them. this looks composite pattern without recursion. if not it's random polymorphism. not has name. http://en.wikipedia.org/wiki/composite_pattern

c++ - Why: vector crash when I try to push_back more than 16777216 -

i trying push_back instances of object vector (e.g. a; vectora.push_back(a)) code crashes whenever try push_back more once size of vector more 16777216 (16*1024*1024) (the capacity of vector 16777216 well, means vector reallocate memory). anyone knows how should deal issue? checked memory used 320mb. since std::vector wrapper around basic c array, has same limitations normal array, described here: is there max array length limit in c++? agree comments above contiguous memory limit. work around can switch using std::vector other class, not use arrays ( map, list or deque depending on needs ). solution using several vectors.

ios - Present UIWebview on top on currently displayed view controller -

i'm trying modally display uiwebview on top of displayed view controller. code popup webview lives in static library , has no idea view controller hierarchy of app lives in. code below works test cases, not sure if work possible view controller hierarchies. uiviewcontroller *rootviewcontroller = [[[uiapplication sharedapplication] keywindow] rootviewcontroller]; uiviewcontroller *presentedvc = [rootviewcontroller presentedviewcontroller]; if (presentedvc) { // have modally displayed viewcontroller on top of rootviewcontroller. if (!presentedvc.isbeingpresented) { [presentedvc presentviewcontroller:vc animated:yes completion:^{ // }]; } else { rootviewcontroller presentviewcontroller:vc animated:yes completion:^{ // }]; } does presentedviewcontroller give visible view controller? if want display uiwebview modally on top of whatever view controller displayed in app, don't need "topmost" one. getting root view con

c++ - Change label text from another class using Qt signals and slots -

i'm trying change text of class label class. have class mainwindow, contains label. i have bot class wanna change value of label. i'm trying create signal , slots have no idea start. i created signal , slots so: //in mainwindow.h signals: void changetextsignal(); private slots: void changetext(); //in mainwindow.cpp void mainwindow::changetext(){ this->label->settext("foobar"); } but have no idea how connect signal able change label's text class. read on qt signal-slot mechanism . if understand correctly, trying signal bot mainwindow label text needs change. here's how it... //bot.h class bot { q_object; //other stuff here signals: void textchanged(qstring); public: void somefunctionthatchangestext(const qstring& newtext) { emit textchanged(newtext); } } //mainwindow.cpp mainwindow::mainwindow { //do other stuff this->label = new qlabel("original text"); mybot = new

How to Read last lines from a big file with Go every 10 secs -

how can read last 2 lines big log file without load memory completely? i need read every 10 secs(on win machine)...and i'm stuck trying read last lines.. package main import ( "fmt" "time" "os" ) const myfile = "logfile.log" func main() { c := time.tick(10 * time.second) := range c { readfile(myfile) } } func readfile(fname string){ file, err:=os.open(fname) if err!=nil{ panic(err) } buf:=make([]byte, 32) c, err:=file.readat(32, ????) fmt.printf("%s\n", c) } the log file like: 07/25/2013 11:55:42.400, 0.559 07/25/2013 11:55:52.200, 0.477 07/25/2013 11:56:02.000, 0.463 07/25/2013 11:56:11.800, 0.454 07/25/2013 11:56:21.600, 0.424 07/25/2013 11:56:31.400, 0.382 07/25/2013 11:56:41.200, 0.353 07/25/2013 11:56:51.000, 0.384 07/25/2013 11:57:00.800, 0.393 07/25/2013 11:57:10.600, 0.456 thanks! you can use file.seek() or file.readat() end , read

java - Using IntelliJ IDEA with Oracle XE.. I dont see database or table? -

Image
i new oracle , trying use intellij idea database browser see data , tables.. i did basic install of oracle xe on linux computer , following java code insert , return data: try { //step1 load driver class class.forname("oracle.jdbc.driver.oracledriver"); //step2 create connection object connection con = drivermanager.getconnection( "jdbc:oracle:thin:@localhost:1521:xe", "system", "xxx"); //step3 create statement object statement stmt = con.createstatement(); //step4 execute query boolean ret = stmt.execute("insert emp values (1, \'john\', 43)"); resultset rs = stmt.executequery("select * emp"); while (rs.next()) system.out.println(rs.getint(1) + " " + rs.getstring(2) + " " + rs.getstring(3)); //step5 close connection ob

vbscript - Return registry key value to copy files to directory -

does know hoe return value of registry key of know location of key can use copy file installed directory? know registry key contains installed path of program , wish copy file installed directory without knowing install directory other returning registry. trying in vbscript

xml - How Do I Make my Screen Scrollable in Android Eclipse -

this xml code have before attempt adjust scrollable: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <!-- widgets --> </relativelayout> how edit make scrollable? dragging on scrollview widget list messes up. make sure leave version/encoding line @ top of file. change relativelayout scrollview , nest relativelayout section (containing of widgets) inside new scrollview . make sure give relativelayout dimensions, should same scrollview width , height dimensions. the reason nesting of relativelayout contains widgets scrollview element can have 1 child element (in case, relativelayout , has own children). therefore code: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="

Game network programming synchronizing graphs -

i trying develop computer game. want game multiplayer playable. game arcade space shooter i plan run game @ server level , send updates @ clients. problem facing object creation. let's if player shots, shots new objects. these need created. in game have hierarchical structure , shots part of structure. tree. problem have identifying objects on clients , server. how can make sure when client receives update update right objects? what new object creation. in case scene graph traversed , each object updated once gets updates server. updates creates new object violates principle. how should handle them? also, can't updates entire scene. need update specific objects visible player. should rest of objects aren't visible? happen when become visible? how can track when objects become visible player? how can make sure when client receives update update right objects? you can give unique id each object server creates. might want create super object cl

Delphi Service to Listen to TCP or UDP -

reading question: delphi windows service design , saw designer use code below in onexecute of tservice or in tthread method, in order keep service alive. while not terminated begin // end; but if need (and do) create service respond (using indy) messages sent main application in order send authentication data, do code, ignore or put sleep() in it? indy's tidtcpserver , tidudpserver components multi-threaded, don't need use tservice.onexecute event @ all. activate them in tservice.onstart event , deactivate them in tservice.onstop event, , assign handlers tidtcpserver.onexecute , tidudpserver.onudpread events needed. both events looped you, don't need while not terminated loop in them. read/process 1 request needed, exit, , wait next event repeat. let server handle exceptions raised. , keep in mind tidudpserver has threadedevent property false default, should set true inside service.

mysql - Most efficient way to count how many rows have been entered in different tables within the X days? -

given several tables, best way take poll of row counts in tables clauses included? i'd @ once can inserted table daily record of row counts. tablea - count of rows fit condition 1, specific column value x select count(*) tablea col1 = x tablea - count of rows fit condition 2, specific column value y select count(*) tablea col2 = y these 2 combined into: select (select count(*) tablea col1 = x) 'x count', (select count(*) tablea col2 = y) 'y count' but i'd add in: tableb - count of rows created within last specified interval select count(*) tableb datecreated >= date_sub(curdate(), interval 1 day) col3 = z; this gives me: select (select count(*) tablea col1 = x) 'x count', (select count(*) tablea col2 = y) 'y count', (select count(*) tableb datecreated >= date_sub(curdate(), interval 1 day)) 'z count'; it seems run though, there more efficient way of counting rows in case? your query looks fine,

javascript - Disable next form field on dynamically inserted form elements -

i know has been asked many times before none of solutions seem work in situation. i need checkbox on each row disable next text field. each table row created on fly (js clone). first row static. each subsequent row, name , id appended new number (formfield1, formfield2, etc) , happen after page has loaded. html <div class="add_rec_container" id="fuel_stop" style="display:block;"><!--open #fuel_stop--> <p class="label">enter fuel stop:</p> <table width="100%" border="0" cellspacing="0" cellpadding="0" id="fuel_stop_table" class="fuel_data"> <tbody> <tr> <td><select name="data_fuel_state1" id="data_fuel_state1" class="state_menu"> <option value="az">az</option> <option value="ca" selected="selecte

python - simplifying maybe Monad -

i trying understand maybe monad of examples saw used language-specific feature. ensure have gotten conceptually right thought of writing generic implementation. below came with. can tell if have gotten conceptually right? there better way generalize it? def f(): return 2 def g(): return 4 def h(): return 7 def i(): return none def bind(val, func): if val none: return none else: return(func()) unit = 0 >>> bind(bind(bind(unit,f),i),h) #returns nothing >>> bind(bind(bind(unit,f),g),h) #returns value >>>7 what if wanted add values these functions , abort if of null; suggestion? you're close, signature of bind is m -> (a -> m b) -> m b so it's "unwrapping" m , passing contained value next function. have m -> ( () -> m b) -> m b since you're ignoring val bind gets, should have def bind(val, func): if val none: return none else:

while creating application session for google oauth 2 for ios returns invalid_grant -

i'm using google's oauth2.0 process let users sign within ios app. after gtmoauth2viewcontrollertouch returns gtmoauth2authentication still have create own application session backend. know flow our website working. i tried validate session posting gtmoauth2authentication auth code google i'll 400 invalid_grant error. (for testing porpuses used objective-c post handled our backend) nsdictionary *data = @{ @"code":googleauthcode, @"redirect_url":@"urn:ietf:wg:oauth:2.0:oob", @"client_secret":sd_oauth_client_secret, @"client_id":sd_oauth_client_id, @"grant_type":@"authorization_code" }; afhttpclient *google = [[afhttpclient alloc] initwithbaseurl:[nsurl urlwithstring:@"https://accounts.google.com"]]; nsstring *path = @&

.net - Why is New() firing twice on my inherited controls? (winforms) -

Image
step 1 : create inhered control class public class test_control inherits listbox public sub new() items.add("test") end sub end class step 2 : drag class form in designer step 3 : run project result : why happening?! stumped here.. have googled , googled , cannot find solution or answer this. this causing major issues me. trying add initial "select one..." option every newly created combobox. same thing happens every inherited control class, regardless of control type (textbox/combobox/listbox/etc). same thing happens if use message box within new(). 2 message boxes appear run application. you need tell designer not serialize items collection: public class test_control inherits listbox public sub new() items.add("test") end sub <designerserializationvisibility(designerserializationvisibility.hidden)> _ public shadows readonly property items listbox.objectcollection

c - Is it possible to create a struct whose size is not known at compile time? -

as question states looking create struct in c total size not know @ compile time. for example, create struct contains count value , array count elements. know implemented as: typedef struct mystruct{ int count; int *myarray; } mystruct; however, want struct take 1 solid block of memory use memcpy() on @ later point in time. this: typedef struct mystruct{ int count; int myarray[count]; } mystruct; it sounds you're looking flexible array members: typedef struct mystruct { int count; int myarray[]; } mystruct; then, when allocate later: mystruct *x = malloc(sizeof(mystruct) + n * sizeof(int)); x->count = n;

sql - Oracle maintaining a column based on the values of other columns in the same table -

in student table query create default constraint on column address value should updated automatically based on data of city+''+street+''+houseno. well if column based on values in other columns not create new column @ redundant. construct value when query table. you virtual columns means ensuring definition of constructed value consistent , indexed, however. http://docs.oracle.com/cd/b28359_01/server.111/b28279/chapter1.htm#featureno07254

c++ - Overloading assignment operator: different datatypes - impossible? -

i trying make impossible operator overloading. particularly interested in overloading assignment operator, receive another data type value right hand value. should this: myclass myclass = "hello world"; <--- wrong? myclass myclass2; myclass myclass = myclass2; <--- right? then myclass object should receive string , handle it. unfortunately, read possible assign same data type value custom made class. true or mistaken? this code have: class myclass { public: myclass() {}; virtual ~myclass(); myclass& operator = (const myclass&); private: char* string; }; myclass& myclass::operator= (const myclass& inc){ string = inc; } int main(int argc, char** argv) { myclass myclass = "hello world"; std::cout << myclass; } as can see, want cout object string. basically, want custom class treated string. search in google , stackoverflow search engines denied wish, or there workaround? looking f