Posts

Showing posts from March, 2011

php - Display drowdown values after user has selected 3 option -

i have 3 drop downs want display whatever user select after he/she has selected function or scrpt must within script <?php $resource_names = mysql_query("select distinct name selections order id asc"); $names = array(); while($row = mysql_fetch_row($resource_names)){ $names[] = $row[0] } $resource_surnames = mysql_query("select distinct surname selections order id asc"); $surnames = array(); while($row = mysql_fetch_row($resource_surnames)){ $surnames[] = $row[0]; } $resource_emails = mysql_query("select distinct email selections order id asc"); $emails = array(); while($row = mysql_fetch_row($resource_emails)){ $emails[] = $row[0]; } if(count($emails) <= 0 || count($surnames) <= 0 || count($emails) <= 0){ echo 'no results have been found.'; } else { // display form echo '<form name="form" method="post" action="test.php">'; //names dropdown:

smtp - django alternative EMAIL_HOST settings -

i want implement django managment command send emails smtp not default settings settings.py file such as: email_host email_host_user email_host_password from_mail email_use_tls i want send alternative settings different settings.py without change email settings site. how implement this? define alternate email settings , create new mail connection using settings: settings.py alternate_email_host_password = 'your password' alternate_email_host_user = 'your user' alternate_email_host = '' alternate_email_port = 123 alternate_email_use_tls = true then create new connection using settings: from django.core import mail django.core.mail import send_mail django.conf import settings # create new connection connection = mail.get_connection() connection.password = settings.alternate_email_host_password connection.username = settings.alternate_email_host_user connection.host = settings.alternate_email_host connection.port = settings.alternate

javascript - facebook link preview generation -

i include facebook link preview on page. have website registered facebook app. have input , every time user enters url there, show same preview in facebook during wall post. how can this? thanks, alex a. basically need make request html of page want preview. web developers put stuff want in facebook preview in meta tags in head. this: <meta property="og:image" content="http://image.png"> then have stuff using jquery var imgsrc = $(html).filter('meta[property="og:image"]').attr('content'); and put wherever document.getelementbyid("wherever").innerhtml = '<img src="' + imgsrc + '" />'; edit: sorry realized wanted facebook api. don't have method that, you're going have make own.

Django image file not getting uploaded -

models.py class report(models.model): user = models.foreignkey(user, null=false) photo_files_attached = models.booleanfield('photos', default=false) forms.py class mediaform(forms.modelform): photo_files_attached = forms.filefield(label='choose file') class meta: model = report field = ['photo_files_attached'] views.py def media(request): user = request.user try: report = report.objects.get(user=user.id) except: report = none mediaform = mediaform() if request.method =='post': mediaform = mediaform(request.post,request.files) if mediaform.is_valid(): media = report(photo_files_attached = request.files['photo_files_attached']) media.save() return render(request, 'media.html', { 'mediaform':mediaform, }) i trying upload image file through django ,

First assembly program error -

i have written asm program try teach myself asm. doesn't seem working in emu8086, , have absolutely no idea why. org 100h mov dx, 05 cld while: int 21h cmp dx, 1 jz outt dec dx mov ah, 09h int 21h jmp while outt: mov ah, 4ch mov al, 00 int 21h ret the bleak world of assembler no place uninitiated venture without guide... your atlas great tome of ralf - importantly, chapter 21h . the first thing doing setting dx 5. why you'd want unknown, since haven't commented action. then clearing direction flag cld . sensible - ensures auto-adjustment of registers in string instructions proceeds in logical direction. your next action puzzling. when execute int 21h you're asking os something. if refer atlas, you'll find operation executed depends on value in ah . currently, that's 0, since you've not explicitly set in program. hence, if visit verse 00 of chapter 21h of tome of ralf may find out why program

authentication - How to know if a user is logged in from another service -

i have php/apache service , meteor on same server. using accounts-ui package. there anyway know in php script, user logged in, given login token (session id?) this original need: upload profile picture logged in user. simple right? have not found answer after hours of googling. first solution using html5 file apis send data meteor server , server save image. solution wont work ie9. second solution trying: using html form upload picture php script (or whatever script, can nodejs script if needed). script save image traditional php script does. thing cannot know if upload request authorized, otherwise can change profile picture of anybody. must add information in upload request , verify them in php code before saving image. thinking sending request php script meteor server need know parameters send , how meteor responses it. how can achieve second solution or if has solution origin problem great. thank you. meteor uses protocol called ddp communicate between clien

jquery - How to scroll xx pixels or % at once -

i building website , want customize scrolling. if user scrolls want them scroll down 100% @ once in website: http://onlinedepartment.nl/ edit: managed smooth scrolling anchor points. want work on mousescroll too any ideas? in advance that website pretty nice. there's kind of alot of stuff keep in mind this. here's demo of things describe below ( fiddle ). every "page's" height high window.innerheight - /* height of menu */ every time scroll you'll have check if scroll upwards or downwards you can updating variable on every scroll event window.pageyoffset value , check if new value higher or lower this, if it's higher you're scrolling downwards . if event.originalevent.wheeldeltay > 0 you're scrolling upwards. event scroll event. then on every down(up)scroll you'll want scroll 1 page's height down or up. can have variable save page you're on or can see how many pages current window.pageyoffset corresponds to.

Java Unicode to hex string -

this question has answer here: get unicode value of character 7 answers the code below gives me unicode string கா sysout = new printstream(system.out, true, "utf-8"); sysout.println("\u0b95\u0bbe"); by giving கா input, can hex values \u0b95 , \u0bbe ? ps: tamil language. according this you'll have try system.out.println( "\\u" + integer.tohexstring('க' | 0x10000).substring(1) ); but work on unicode 3.0. if want more values, create loop, e.g. string foo = "கா"; (int = 0; < foo.length(); i++) system.out.println( "\\u" + integer.tohexstring(foo.charat(i) | 0x10000).substring(1)); which produces \u0b95 \u0bbe if want have them in 1 line, change system.out.println() system.out.print() , add system.out.print("\n") in end.

python 3.x - How do I change the same parameter on multiple objects efficiently in Blender? -

starting single cube, have changed properties (material, color, reflection attributes), , duplicated object dozen cubes, placing them in scene. after rendering, i'd change color of of them. how do efficently? i have found multiple ways already: in object mode, select objects ( b , rectangular select), join meshes ctrl-j , change color, tab edit mode, p seperate objects again. quite possible since meshes of objects not touch. basics docs someone wrote python script similar stuff, here number 1 error prone , tedious regular use. number 2 more specialized , worse. selecting multiple objects , changing value not work because property selections apply active object 1 of selected. as common use case i'm missing easy way. it? while did not find preferred simple button or gui solution, turned out hacking own python code in blender easier 1 might think. the cubes working more domino stones. subsequently objects looking dominoes have name starting "domino

Inserting table in SQL server using Cursor -

i trying import excel file sql , file has 3 columns : box - code - validity using following query use [libatel] go set ansi_nulls on go set quoted_identifier on go alter procedure [dbo].[getdataexcel] declare c cursor select box, code , validity openrowset('microsoft.ace.oledb.12.0', 'excel 12.0;database=c:\barcodes.xlsx;hdr=yes', 'select box, code , validity [sheet1$]') declare @code bigint declare @box bigint declare @validity date begin open c fetch next c @code,@box,@validity while @@fetch_status = 0 begin select @box = box,@code = barcode,@validity =validitydate cards insert cards (barcode,box,validitydate) values (@box,@code,@validity) fetch next c @box,@code,@validity end close c deallocate c end i getting folowing 11155232026 1 2013-05-18 1 11155232026 2013-05-18 ... ... this first line , box , code changing places on each line , doing wrong ? your second fetch has wrong column order: f

Cannot delete files transfered from computer in Android -

i'm making video downloader app , i've got no problems saving , deleting files downloaded app external storage file transfered computer cannot deleted app. this real problem it's 1 of key features want. here's code i'm using: public boolean deletedatafromstorage(data todelete) { //the file object deleted file f = null; log.e(tag, "deleting " + todelete.filename); // delete file storage try { // file delete f = new file(environment.getexternalstoragedirectory().getcanonicalpath() + directory + todelete.filename); } catch (ioexception e) { log.e(tag, e.tostring()); // print stack trace e.printstacktrace(); } // delete file if(f.delete()) { return true; } else { log.e(tag, "failed delete " + todelete.filename); return false; } } as f.delete() function doesn't throw exceptions have no idea problem is. thing can think of

web applications - C# if page is closed and page close events -

i writing web forms application in .net framework 4.5. in asp page, there way check , action before closing browser page. example, sign out or call function if user clicked "x (close)" button of tab or browser window. there method handle exit? (i prefer having close reason. user closed or error closed etc.) there unload event, if implement something before page closed , should on client side since cannot make further changes response stream when unload called. please refer page life cycle details. jquery unload choice type of controls.

ruby on rails - Devise AJAX - POST request : current_user is null -

i try develop single page application authentication. use devise (rails) , angularjs. different reasons rails application , angularjs application not on same server. so, have handle cross domain issues... , can't send x-csrf-token in header. can correctly sign in , sign out , send request without problem. in rails controllers, can use current_user, it's correctly set. however, when send post request, current_user null. seems session_id not sent. problem due cross domain, because if send ajax request same server, ok. i think, have 2 solutions : - don't use authentication cookie-based, use token - put front-end , back-end on same server. other ideas ? why current_user null when send post request cross domain ? you send csrf token in headers it's bad practice exposes security holes ( issue thread on github explaining why ) safest way go disable csrf together: class applicationcontroller < actioncontroller::base # or use api::basecontroller <

javascript - Implementing One page web site's navigation -

i building 1 page web site has sticky navigation on it. have implemented everything, couldn't implement highlight navigation link when user scrolling mouse wheel or browser's scroll bar instead of using navigation. guess can implemented adding pre-styled class section closest top? my second question how stop scrolling when user while page scrolling? my site markup <nav class="columns col-12 main-nav"> <ul> <li><a href="#page1" class="selected">a link</a></li> <li><a href="#page2">another link</a></li> <li><a href="#page3">cat</a></li> <li><a href="#page4">dog</a></li> </ul> </nav> <div class="container"> <section class="page" id="page1" data-stellar-background-ratio="1.75"&g

Python main function -

this question has answer here: what if __name__ == “__main__”: do? 18 answers i came across line in python: def somefunc: [...] if __name__ == '__main__': somefunc i don't understand "if __name ..." does. suppose have: if __name__ == '__main__': main() #this code find main so similar main() function in c/c++, gets executed before other function? you can think main() in c or begin { } block in perl. when run code using python file1.py. __name__ in file1.py equal '__main__' , in other files imported file1.py, variable else.

xml - how to make custom key in soft keyboard in android -

i trying develope custome soft keyboard in android, want change color of outptut text of key when press on th key, idea make class extends key code: public class k extends key{ private paint mtextpaint; public k(resources arg0, row arg1, int arg2, int arg3,xmlresourceparser arg4) { super(arg0, arg1, arg2, arg3, arg4); initlabelview(); attributeset attributes = xml.asattributeset(arg4); typedarray =arg0.obtainattributes(attributes, r.styleable.labelview); settextcolor(a.getcolor(r.styleable.labelview_textcolor, 0xff000000)); a.recycle(); initlabelview(); } private final void initlabelview() { mtextpaint = new paint(); mtextpaint.setantialias(true); mtextpaint.settextsize(16); mtextpaint.setcolor(0xff000000); } public void settextcolor(int color) { mtextpaint.setcolor(color); } } and set attrs xml file in value folder (like custom view)

three.js - UV calculation on custom 3d mesh -

after making research, didn't find yet formula offer me way push facevertexuvs on custom mesh (basically countries on top of sphere), need burn world texture on polygon, , don't know how compute correctly uv coordinates. even formula on wikipedia :/ please need helps the problem : calculation each vertex uv coordinates any tips, advices, links welcome. i've found solution application not quite sure , texture appears not point, 3 vectors normal compose face,and compute uv arctan2, , asin, adding after 0.5 correct range [0,1] you don't specify shape of countries? them extruded mesh? you looking spherical projection mapping , known problem, centuries ago: http://math.rice.edu/~polking/cartography/cart.pdf

javascript - How to loop through an array containing objects and access their properties -

i want cycle through objects contained in array , change properties of each one. if this: for (var j = 0; j < myarray.length; j++){ console.log(myarray[j]); } the console should bring every object in array, right? in fact displays first object. if console log array outside of loop, objects appear there's more in there. anyway, here's next problem. how access, example object1.x in array, using loop? for (var j = 0; j < myarray.length; j++){ console.log(myarray[j.x]); } this returns "undefined." again console log outside loop tells me objects have values "x". how access these properties in loop? i recommended elsewhere use separate arrays each of properties, want make sure i've exhausted avenue first. thank you! use foreach built in array function yourarray.foreach( function (arrayitem) { var x = arrayitem.prop1 + 2; alert(x); });

Sphero: getting real time location data to stop sphero (android) -

i trying build android application sphero need stop sphero in zones of room , trying locatordata using devicemessenger.asyncdatalistener . i have noticed, impossible tell while still rolling , stop when in set of coordinates, because data arrives great delay. stops farther , can see coordinates increasing delay on screen. know communication asynchronous , somehow losing data during communication thought giving him window around coordinates want him able stop him more or less in zone, doesn't works decently. for now, solution i've come send roll command, calculate amount of time needs roll coordinates based on velocity , send delayed stop command, don't solution , don't think it's going work correctly in long run, when implement features need. have suggestions locatordata , how use in case? i have used 'locatordata' before , trying possible. there couple ways can go accomplishing it. the great delay experiencing not communication delay, f

solr - Solrj IOException occured when talking to server -

i using basic authentication. solr version 4.1. can query results when try index documents getting following error message: org.apache.solr.client.solrj.solrserverexception: ioexception occured when talking server at: http://192.168.0.1:8983/solr/my_core @ org.apache.solr.client.solrj.impl.httpsolrserver.request(httpsolrserver.java:416) @ org.apache.solr.client.solrj.impl.httpsolrserver.request(httpsolrserver.java:181) @ org.apache.solr.client.solrj.request.abstractupdaterequest.process(abstractupdaterequest.java:117) @ org.apache.solr.client.solrj.solrserver.add(solrserver.java:116) @ org.apache.solr.client.solrj.solrserver.add(solrserver.java:102) @ warningletter.process.run(process.java:128) @ warningletter.warningletter.parselistpage(warningletter.java:81) @ warningletter.warningletter.init(warningletter.java:47) @ warningletter.warningletter.main(warningletter.java:21) caused by: org.apache.http.client.clientprotocolexception @ org.apa

ajax - apc_fetch PHP 5.3 with Zend Server -

i encountered problem when wanted show process bar in file upload. my php version 5.3.14. zend server version 5.6. turned off zend data cache & zend optimizer+. here upload code. <?php $uiq = uniqid(); $image_folder = "uploads/"; $uploaded = false; if(isset($_post['upload_image'])){ if($_files['userimage']['error'] == 0 ){ $up = move_uploaded_file($_files['userimage']['tmp_name'], $image_folder.$_files['userimage']['name']); if($up){ $uploaded = true; } } } ?> following process code called ajax. if(isset($_get['progress_key']) , !empty($_get['progress_key'])){ $status = apc_fetch('upload_'.$_get['progress_key']); if($status){ echo $status['current']/$status['total']*100; }else{ echo 0; } exit; } the apc_fetch function return false. know reason?

ios - Apply a perspective transform without rotating -

Image
i have been trying perform perspective transform on uiview. have been working example . however, example applies rotation on view perspective change. there way change perspective of view no rotation? might this: i have been trying remove rotation, when perspective transform not applied. can't find examples out there deal changing perspective. in advance. just adding david's answer: output in image have rotate view around x-axis (the horizontal axis) upper edge of view rectangle appears "further away" viewer lower edge, e.g. catransform3d rotationandperspectivetransform = catransform3didentity; rotationandperspectivetransform.m34 = 1.0 / -200; rotationandperspectivetransform = catransform3drotate(rotationandperspectivetransform, 45.0f * m_pi / 180.0f, 1.0f, 0.0f, 0.0f); layer.transform = rotationandperspectivetransform;

sql - Update one row in the table, using liquibase -

i hoping if verify if correct syntax , correct way of populating db using liquibase? all, want change value of row in table , i'm doing this: <changeset author="name" id="1231"> <update tablename="sometable"> <column name="properties" value="1" /> <where>propertyname = 'somenameofthepropery"</where> </update> <changeset> all want change 1 value in row in table. above doesn't work, although application compiled , didn't complain, alas, value wasn't changed. thank you yes possible. see below syntax: <changeset author="name" id="1231"> <update catalogname="dbname" schemaname="public" tablename="sometable"> <column name="properties" type="varchar(255)"/> <where>propertyname = 'somenameofthepropery'</

php - Trouble accessing JSON data through URL with CakePHP -

i'm passing data knockout.js form controller in cakephp, i'm bit confused how access data. the url being passed orders/submit_order/%7b"orderinfo":[%7b"itemnumber":"1","quantity":"1","price":1.00,"productname":"test product"%7d]%7d in controller tried echo url after decoding came null every time. debugged , found out it's showing named parameter function submit_order($order = null){ $this->layout = false; $this->autorender = false; $order = json_decode($order, true); $print_r($order); //shows null debug($this->params); //$order_2 = json_decode($this->request->params['named'], true); //says string required, array given $order_2 = $this->request->params['named']; print_r($order_2); echo $order_2['orderinfo'][0]['itemnumber']; } the debug statement returns following object(cakerequest) { params

android - Theme Issue with PreferenceActivity -

in app let user choose theme wants use (dark or light). themes defined in styles.xml followed: <style name="but" parent="android:style/widget.holo.actionbutton"> </style> <style name="bar" parent="android:style/widget.holo.actionbar.solid"> </style> <style name="theme_flo" parent="android:theme.holo"> <item name="android:buttonstyle">@style/but</item> <item name="android:actionbarstyle">@style/bar</item> </style> <style name="theme_flo_light" parent="android:theme.holo.light.darkactionbar"> <item name="android:buttonstyle">@style/but</item> <item name="android:actionbarstyle">@style/bar</item> </style> the dark theme applied everywhere correctly. the light theme ok except text color of actionbar (it's b

c - run code stored in memory -

problem: run non-trivial c program stored on heap or data section of c program asm instructions. my progress: ran set of simple instructions print stdout. instructions stored on heap , allowed page containing instructions executed , calling raw data though function. worked fine. next up, want given statically linked c program, read it's binary , able run it's main function while in memory c program. i believe issues are: * jumping main function code * changing binary file's addresses created when linking relative code lies in memory please let me know if approach or whether missed important , best way go it. thank you modern oses try not let execute code in data because it's security nightmare. http://en.wikipedia.org/wiki/no-execute_bit even if past that, there lots more 'gotchas' because both programs think 'own' stack/heap/etc. once new program executes, it's various bits of ram old program stomped on. ( exec exi

css - Control images wont show up in jQuery skitter slideshow plugin? -

i want add image icons slideshow plugin, wont work...even though have added images , referenced them in css? path images folder correct. css: http://codepad.org/7pkgovye java: <script type="text/javascript" language="javascript"> $(document).ready(function () { $('.box_skitter_large').skitter({ theme: 'clean', numbers_align: 'center', progressbar: true, dots: true, preview: true, controls: true }); }); </script>

android - canvas.scale() not working properly -

i have following code, when pinch in screen join/split objects. import android.content.context; import android.graphics.canvas; import android.graphics.color; import android.util.attributeset; import android.util.log; import android.view.motionevent; import android.view.scalegesturedetector; import android.view.view; import android.view.scalegesturedetector.simpleonscalegesturelistener; import android.view.animation.scaleanimation; import android.widget.relativelayout; public class gdticketgroupview extends relativelayout{ //constants int knumberoftickets = 3; int kticketwidth = 225; int kticketheight = 100; int kmarginleft = 12; int kmargintop = 12; int kmarginright = 12; int kmarginbottom = 12; float kminscale = 0.5f; float knormalscale = 1.0f; float kmaxscale = 1.2f; //variables float mscalefactor = 1; boolean scaling = false; relativelayout gestureview; //temporary float tmpscale = 1; //objects scalegesturedetector scalegesturedetector; gdticketview ticket; public gdtick

OOP & Java: how to generalize from an abstract class? -

first of all, i'd apologize grammar, since english not first language, make grammar mistakes... there problem prevent me making generic code: how put abstract class abstract methods inside abstract class? know abstract classes can't instantiated, but... isn't there way genericity? one example : have abstract class feline , class has several abstract methods. there class: cage class, can contain amount of 1 kind of feline objects (say cage of cats, cage of tiggers, cage of lions, etc.)... how do this? can't instantiate felines inside cage class... , how make cage of cats? another example , i've noticed can sort collection of stuff using 2 sorting criteria: stuff goes after stuff? and: stuff goes before stuff? so, every sortable stuff must have 2 boolean methods: "goesafter(stuff): boolean" , "goesbefore(stuff): boolean", then, put stuff on class through composition/agreggation relationship, lets call lotsofsortablestuff class, ,

content management system - How to make Fancybox work in Pagelime CMS? -

i´ve noticed fancybox cant handle pagelime autogenerated href links... here works > http://miaumiauestudio.com/artistas/colmegna/ but here, after user uploads content , publishes href turns in "cms-assets/images/820798.ale-seeber---st--oil-on-canvas---116-x" , prevents fancybox working right! http://miaumiauestudio.com/artistas/seeber/ is there solution? i´m calling fancybox "rel" attribute avoid other errors, dont know how make href link address! $(document).ready(function() { $("a[rel=gallery]").fancybox(); }); thanks in advance!

Does original alarm clock in android broadcast intent upon alarm? -

i want start application (let's brush teeth)on specific time , day. , don't want write alarm service code alarm part. rather, want know if possible: 1- use original alarm clock comes shipped phone set alarm name. let's time= "6:30 on monday" , name= "pssst!! brush teeth" 2- alarm start ring on monday morning @ 6:30 psst!!... name 3- question here, alarm broadcasts intent (for instance intent.action.bootcomplete) can received broadcast receiver start activity in onreceieve method? in short lazy write additional code , want use existing phone clock service. any possibility of success lazy approach? it's not exact answer on question. however, recommend use alarmmanager: http://developer.android.com/reference/android/app/alarmmanager.html all need create intent app , schedule it. pretty minimal (2-3 lines setting up, 1 receiver , definition of receiver in manifest). you can check example here: alarm manager example

css - How to dynamically center an image that repeats on the x-axis with javascript? -

i have background image 1500px in width , repeats on x-axis. dynamically center image no matter user's viewport width image's center in middle of screen? how can accomplish javascript? you shouldn't need javascript this, css (or should) fine: background-position: center center; background-repeat: repeat-x; that line ensure image centered in element, , repeats starting center of element. more info on background-position here .

forms - javascript function inside function -

i have started javascript , want validate form. tutorials i've found create alert feedback, i'd use onblur , give error message next field. managed 2 functions separately can't merge them. i'd appreciate help! this came with, doesn't need: function validatefirstname() { var x=document.forms["demo"]["firstname"].value; if (x==null || x=="" || x==) { function addmessage(id, text) { var textnode = document.createtextnode(text); var element = document.getelementbyid(id); element.appendchild(textnode); document.getelementbyid('firstname').value= ('firstname must filled out') } return false; } } so following simple way validate form field checking value of input when form submitted. in example error messages sent div element form should still out. the html code looks this: <

android - How to move object in corona sdk? -

hey using code move (animate) objects on scene leaks memory , stop responding. //transition local function goback( ) transition.to ( wall2, { time = 10000, x = 100, y = 310, oncomplete = starttransition}) transition.to ( wall, { time = 10000, x = 700, y = 200, oncomplete = starttransition}) transition.to (gate_a, { time = 10000, x = 100, y = 255, oncomplete = starttransition}) transition.to ( stargate_a, { time = 10000, x = 100, y = 255, oncomplete = starttransition}) end //transition start function starttransition( ) transition.to ( wall2, { time = 10000, x = 700, y = 310, oncomplete = goback}) transition.to ( wall, { time = 10000, x = 100, y = 200, oncomplete = goback}) transition.to ( gate_a, { time = 10000, x = 700, y = 255, oncomplete = goback}) transition.to ( stargate_a, { time =10000, x = 700, y = 255, oncomplete = goback}) end starttransition() how move objects without leaking memory? do this: //transition local function go

Integration between Google app engine and amazon rds -

i novice trying develop android app using google app engine. google cloud sql paid service , hence thinking of using amazon rds cloud database. technically feasible? factors need consider using approach? drawbacks? thanks in advance answers.. cheers, nitu..

bxSlider not working on AJAX loaded content -

i using bxslider on site. when select size dropdown menu, use ajax specific content slider , input it. the content there, no worries. doesn't work actual slider. when click on arrows, doesn't move or anything. on loading new content slider, call slider function, doesn't work. any ideas? this code below inserting ajax content in correct element on page, calling slider function. $('.bxslider').html(po_data.slider); runslider(); i solved else having same problem. destroyed slider, recalled again. var go_slider = null; function runslider() { if (go_slider) { go_slider.destroyslider(); } go_slider = $('.bxslider').bxslider({ minslides: 4, maxslides: 4, moveslides: 4, slidewidth: 208, }); } works perfectly! hope can out!

javascript - A Slider with Ajax-loaded content -

i have following page pagination: <div class="pagination-centered hide"> <ul class="pagination"> <li class="current"><a href="">1</a></li> <li class="next"><a href="./index.php?path=index2">2</a></li> <li><a href="./index.php?path=index3">3</a></li> </ul> </div> i'm using infinity plugin load content scrolling, this: $("#teaser-slide-ul").infinitescroll({ loading: { finishedmsg: "<div class='alert-box secondarty' style='margin-top: 10px;'>sie haben das ende der bildergalerie erreicht!</div>", msgtext: "<div class='alert-box secondarty' style='margin-top: 10px;'>lade neue bilder nach...</div>" }, navselector: '.pagination

c - lex and yacc — combine two lexers and one yacc -

i have 2 lex files functions xxlex() , yylex() , have 1 yacc grammar file. wanted on grammatical rule invoke xxlex() . xxlex() called once, , want invoked always. how do it? by default, yacc grammars call yylex() obtain new tokens. if want call xxlex() of time, arrange call yylex() @ appropriate times. if want xxlex() called every time, either rename yylex() , rename original xxlex() zzlex() , or use bison -p xx (including parser function) starts xx instead of yy . (the same flag, -p , works posix-compliant yacc . flex program takes -p xx generate symbols starting xx instead of yy ; posix lex not have option so, i've seen many makefile sed script edits source generated lex change prefix yy other letters such xx .)

Insert into mysql from linux terminal -

i have question. can insert mysql database linux terminal record command: mysql dbtest insert tablename values(1,"b","c") now have file in linux records example: $cat file 2, "c", "e" 3, "r", "q" 4, "t", "w" 5, "y", "e" 6, "u", "r" 7, "g", "u" 8, "f", "j" 9, "v", "k" i don't know how can insert records file mysql database linux terminal. i intent bash file don't know =( doing series of inserts not best choice performance-wise. since input data exist csv you'd better off doing bulk load @kevin suggested: mysql dbtest -e "load data infile './file' table tablename fields terminated ','"

swing - keyReleased() method with Key Bindings in Java? -

i'm little bit new key bindings, have been using keylisteners majority until when keylisteners proved biggest obstacle. i'm wondering how program keyreleased-like event keybindings. keylisteners provided easy 3 methods: keypressed, keytyped, , keyreleased, i'm little bit confused how make happen key bindings. basically, when user presses up, want object move upwards. when user releases up, object should move downwards automatically simulate basic gravity. here's little bit of code showing upaction class. class upaction extends abstractaction { public void actionperformed(actionevent tf) { north = true; helitimer.start(); helitimer.start(); helitimer2.start(); repaint(); } } the 3 helitimers timer objects start series of timers increment y position of object continuously , smoothly. when action upaction invoked, class upaction called , 3 timers start in order move object. is there anyway make when user rele

django - How I can get User.username and Group.name -

i need username , name of group user. model use user(default) , group(default) index.html: {% dato in usuarios %} {{dato.first_name|title}} {% item in jefes %} {{dato.groups}} {% if dato.groups == item.id %} #i don't know if {{item.name}} {% endif %} {% endfor %} {% endfor %} view: def inicio(request): usuarios = user.group.all() grupos = group.objects.all() ctx = {'usuarios':usuarios,'grupos':grupos} return render_to_response('index.html', ctx, context_instance=requestcontext(request)) you not need groups queryset view. {% dato in usuarios %} {{dato.first_name|title}} {% group in dato.groups.all %} {{group.name}} {% endfor %} {% endfor %}

c++ - BST in array transversal -

i have following implementation of binary tree in array; 32 / \ 2 -5 / \ -331 399 the data grouped 3 indexes @ time. index%3==0 value of node, index%3==1 index of value of left node , index%3==2 index of value of right node. if left or right index reference 0, there no node direction. i'm trying find depth (height) of tree. i've written recursively height(node): if node == null: return 0 else: return max(height(node.l), height(node.r)) + 1 i want find non-recursive solution, however. here pseudocode have, assuming tree not empty int = 0; int left = 0; int right = 0; while (i != n ){ if ( a[i+1] != 0 ){ left++; } else if ( a[i+2] != 0 ){ right++; } = + 3; } return max ( left, right ) + 1; i don't think right , i'd figuring out how correctly. you haven't said problem recursion understand behavior want improve. there many solutions this, of them have same or worse performance recur

drop down menu - Twitter Bootstrap - How to start dropdown close -

Image
so first of all, here's link site: http://songfreek.com/ this sidebar dropdown navigation doing: this i'd sidebar dropdown navigation do: i guess i'll explain if it's not obvious: want "user" tab automatically start opened upon loading of page, instead of them opening. here's code (which repeats each tab, different content): `<li class="nav-header has_submenu"> <a href="#"> user <i class="icon-angle-down"></i> </a> <ul style="list-style: none;"> <li class="active"><a href="#"><i class="icon-home"></i>home</a></li> <li><a href="#"><i class="icon-envelope-alt"></i>messages <span

Optional query parameters in SQL Server -

i want fetch data sql server database using values dropdown list. my query select age,city,state,caste,incomemin,incomemax ruser (age between '" + drplistagemin.selecteditem + "' , '" + drplistagemax.selecteditem + "') , (religion= '" + drplistreligion.selecteditem + "') "); what need understand how build query if value of religion dropdown optional rather compulsory? in notation of @pratik: select age,city,state,caste,incomemin,incomemax ruser age between @minage , @maxage , religion = coalesce(@religion, religion);

intellij idea - Android Studio "Open Declaration" like eclipse -

is there function "open declaration" in eclipse, can use in new android studio? just f3 button. here more details avoid asking same question other commands: press ctrl + shift + a , , search command you're looking ("declaration") example. finds command "declaration - goto reference action - ctrl + b ". so need put cursor on method want go to, , press ctrl + b ? can ctrl + click achieve same goal. the useful keyboard shortcuts described in help - tip of day dialog box. read them all.

c - feof detecting false end of file -

i asked different question earlier, way off base problem i've created new question i'm asking entirely different question. i have function reads given line in text file (given ac variable). performs read of line , checks if last line in file. if increments value. the problem it's incremented value when it's not actual end of file. think i'm using feof wrong i've had no luck getting work: int readin(tincan* incan, int toggle) { int ii, isfinished = 0; char fullname[20]; sprintf(fullname, "label_%d.txt", incan->pid); file* fp; fp = fopen(fullname, "r"); if(fp==null) { printf("error: not open %s\n", fullname); } else { (ii=0; ii < ((incan->ac)-1); ii++) { fscanf(fp, "%*d %*d %*d\n"); /*move through lines without scanning*/ } fscanf(fp,"%d %d %d", &incan->ac, &incan->state, &incan->time);

java - How do you prevent the main interface from closing, when you close others? -

i've spent last hour searching on google try , achieve - preventing closure of main interface after 1 of others closed. i'm not sure if correct way word question, apologies confusion if there any. i have 1 interface called mainui, main interface starting java program. on interface 2 buttons opens 2 other interfaces (singleplayerstatsui , multipleplayerstatsui). if click on either button, opens appropriate interface (as should), when close opened interface closes main interface (mainui) - isn't want. wondering solution stop main interface closing (which main class of program)? to save space in question, have java project on github (created in netbeans) @ https://github.com/rattfieldnz/java_projects/tree/master/pcricketstats . class file mainui called "mainui.java", class singleplayerstatsui called "singleplayerstatsui.java", , class multipleplayerstatsui called "multipleplayerstatsui.java". these classes located in https://github.com/rat

c - How to post to Google Docs Form directly -

i'm working on project need post data acquire google form , obtain data spreadsheet. cannot use google apps script , need method using direct post method doing function gsm module. solutions posted take consideration old structure of google form provides form key.like solution described in one: http://www.open-electronics.org/how-send-data-from-arduino-to-google-docs-spreadsheet/ the link current form this. https://docs.google.com/forms/d/14mkyg3fpnezzuc_nxuswhlz5jhplvjywtaeob7f_w7g/viewform any appreciated. is requirement google form in middle of this? if enough able post data spreadsheet, here's google-apps-script 1 side of problem: simple web service accept form data query string, , write spreadsheet. this examples assumes simple spreadsheet, 3 columns, "timestamp", "col1" , "col2". edit code suit situation. you can see spreadsheet here , , make test post . /** * doget() function add data spreadsheet. * * sp

spring - Cas 3.5.2 audit failed -

i new-hander cas. download cas-server-3.5.2 , cas-client-3.2.1,then deploy cas server tomcat 6 , 7. change configuration in deployementconfig.xml , other file disable ssl , enable mysql db. when open cas server page: http:// pc-name:8080/cas/login, can sigin on correct . when want sign onto http:// pc-name:8080/cas/services. prompt access denied:usernamenotfoundexception::y2 then integrate cas java webapp shiro-cas. can redirected login page following http:// pc-name:8080/cas/login?service=http:// pc-name:8080/grsp/shiro-cas display following in cosole , redirected error page been fixed up. 2013-05-19 17:09:30,443 info [org.jasig.cas.authentication.authenticationmanagerimpl] -<org.jasig.cas.adaptors.jdbc.querydatabaseauthenticationhandler authenticated [username: y2]> 2013-05-19 17:09:30,458 info [org.jasig.cas.authentication.authenticationmanagerimpl] - <resolved principal y2> 2013-05-19 17:09:30,458 info [org.jasig.cas.authentication.authenticationmanagerimpl]