Posts

Showing posts from June, 2015

html5 - How to animate using css3 -

i want animate menu items using css. have applied animation not working. sort of animation ok. new css. can me out please. here js fiddle upto now: demo here html part.. <div id="back"> <div class="wrapper"> <div class="container"> <ul id="menu" class="menu"> <li id="l1" runat="server" class="active"><a class="link1" href="home.aspx" runat="server" id="a1">home</a></li> <li id="l2" runat="server"><a runat="server" class="link1" href="?id=history" id="a2">about mcb<img src="images/other%20images/dropdown.png" style="position:absolute;margin-right:0px; top: -3px; left: 138px;"/></a> <ul> <li id="l21" runat="server"><a runat=&qu

Enforcing copy semantics for users of my Objective-C class -

i have objective-c class that's intended copy semantics. @property (copy) viewstate* viewstate; it’s not immutable, hangs on viewstate instance needs own distinct copy. in fact, if other class mistakenly tries @property (strong) viewstate* viewstate; we'll crash. how enforce or encourage client classes use correct semantics? in c++, example, prohibit assignment private: cpviewstate* operator=(const cpviewstate*) const; // no implementation but can't in objective-c. opposite case, want prohibit copying, can log error or throw exception copywithzone: . how can either require copy semantics or, @ least, make clear future developers want use copy semantics? copy semantics cannot enforced within class itself, correctly explained. depending on , how viewstate objects created, , means conceptually, there different things work. i not sure viewstate means in project, if makes sense supply singleton/factory viewstatefactory class, have few

c++ - How to make the program waits till the command is executed -

i'm trying execute system command throught program wait till process terminated carry on executing code's instructions. i've been using sleep() didn't work out because relative mean execution time differs machine ...so there solution this? consider code below(language==c++): shellexecute(0, "open", "cmd.exe","/c rasdial adsl user pwd", 0, sw_hide); //can use system(). sleep(sec); if(checkconnection()) {cout <<"u r connected"; } wait till system command executed check connection (i think now). use shellexecuteex instead of shellexecute, , call waitforsingleobject hprocess receive: shellexecuteinfo info = { sizeof(shellexecuteinfo) }; // fill in values in shellexecuteinfo necessary if (shellexecuteex(&info)) { waitforsingleobject (info.hprocess, infinity); // new process has completed } else { // launch failed }

Vagrant synced folder permission issue with apache -

i'm running centos6.4 box. running vagrant up without synced folder config in vagrant file fine. can access on host machine via http://localhost:8080 , displays apache page. create index.html in /var/www/html folder , displays fine too. however after adding line below in vagrant file, visiting page displays 403 forbidden don't have permission access / on server. error instead: config.vm.synced_folder "./source", "/var/www/html", :extra=>"dmode=777,fmode=777" going vm see permission set below in /var/www : drwxr-xr-x. 6 root root 4.0k jul 20 23:15 . drwxr-xr-x. 18 root root 4.0k jul 20 23:15 .. drwxr-xr-x. 2 root root 4.0k may 14 06:12 cgi-bin drwxr-xr-x. 3 root root 4.0k jul 20 23:15 error drwxrwxrwx. 1 vagrant vagrant 102 jul 21 23:14 html drwxr-xr-x. 3 root root 4.0k jul 20 23:18 icons so tried setting apache ownership it, config.vm.synced_folder "./source", "/var/www/

multithreading - Python creating a shared variable between threads -

i'm working on project in python using "thread" module. how can make global variable (in case need true or false) threads in project (about 4-6) can access? we can define variable outside thread classes , declare global inside methods of classes. please see below trivial example prints ab alternatively. 2 variables 'flag' , 'val' shared between 2 threads thread_a , thread_b. thread_a prints val=20 , sets val 30. thread_b prints val=30 since val modified in thread_a. thread_b sets val 20 again used in thread_a. demonstrates variable 'val' shared between 2 threads. variable 'flag' shared between 2 threads. import threading import time c = threading.condition() flag = 0 #shared between thread_a , thread_b val = 20 class thread_a(threading.thread): def __init__(self, name): threading.thread.__init__(self) self.name = name def run(self): global flag global val #made global her

Jenkins plus Git on same server -

i have home server git repositories. i'm trying configure jenkins on existing php repos. i've install jenkins i'm getting error while creating job: repository url = /home/git/repositories/testing.git error following: failed connect repository : command "git ls-remote -h /home/git/repositories/testing.git head" returned status code 128: stdout: stderr: fatal: '/home/git/repositories/testing.git' not appear git repository fatal: remote end hung unexpectedly please resolve problem. thank you. p.s. tries put url i'm using clone repo remotely: ssh://git@192.168.1.110:/testing.git but i'm still getting error: failed connect repository : command "git ls-remote -h ssh://git@192.168.1.110:/testing.git head" returned status code 128: stdout: stderr: ssh: not resolve hostname 192.168.1.110:: name or service not known fatal: remote end hung unexpectedly first issue, if jenkins installe

JQuery blur function not working second time -

hi have textbox has "enter ur name" @ loading. when focus on it, become empty , if dont type , blur change again "enter ur name". works fine many times. problem if focus , enter , removed characters, textbox empty. logic if textbox empty should have "enter " name. jquery here code. pls suggest something. $(document).ready(function (){ var name='enter name'; $('input[type="text"]').attr('value',name).focus(function(){ if($(this).val() == name){ $(this).attr('value',''); } }).blur(function(){ if($(this).val() == ''){ $(this).attr('value',name); } }) }); try this. works fine..... $(document).ready(function(){ var msg= 'enter email.....'; $('input[type="email"]').attr('value',msg).focus(function(){ if($(this).val()==msg){

clojure - When to use alter-var-root with (constantly)? -

i encountered in program: (defonce foo nil) (alter-var-root #'foo (constantly 4)) since code above uses constantly , there reason prefer simple def , below? (def foo 4) is make more consistent defonce , or there downsides using def? (ns banana) (defonce foo nil) (ns user) (use 'banana) foo ;=> nil (alter-var-root #'foo (constantly 42)) foo ;=> 42 (def foo 50) compilerexception java.lang.illegalstateexception: foo refers to: #'banana/foo in namespace: user

lua - Corona Storyboard, declaring an object then making it moveable, nil value attempt -

i creating game, , in level 1 want load few images represent letters, , want add functionalities them. 1 of them ability move them. so inside enterscene is function scene:enterscene(event) ... leta = display.newimage("media/letters/a.png", display.contentwidth/4 - 20, display.contentheight/5 - 18) letc = display.newimage("media/letters/c.png", display.contentwidth/4 + 35, display.contentheight/5 - 18) letr= display.newimage("media/letters/r.png", display.contentwidth/4 + 90, display.contentheight/5 - 18) lete=display.newimage("media/letters/e.png", display.contentwidth/4 + 145, display.contentheight/5 - 18) screengroup:insert(leta) screengroup:insert(letc) screengroup:insert(letr) screengroup:insert(lete) leta:addeventlistener("touch", leta) letc:addeventlistener("touch", letc) letr:addeventlistener("touch", letr) lete:addeventlistener("touch", lete

jquery - send data to php and receive response -

Image
i want send data jquery script file php script file process , receive response, however, response comes content of php file what ? this jquery script: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>test</title> <script type="text/javascript" src= "jquery.js"></script> <script type="text/javascript"> function client(name,lastname){ this.name = name; this.lastname = lastname; } $(function(){ var submit = $("#submit"); var clientname = $("#clientname"); var clientlastname = $("#clientlastname"); submit.click

jquery - How do I disable select option fields when I select a previous option? -

i have 2 select boxes, 1 choose amplifier , second choose cabinet matches it. my problem need add value of disabled="disabled" cabinet options if 'amplifier 2' selected. i have tried few options such as: $("#amp option.grey-out option:selected").change() { $("option.disable").attr("select[disabled='disabled']"); }); here's html: <select required="" autofocus="" id="amp" name="options" class="select-model"> <option data-value="500">amplifier 1</option> <option data-value="1000" class="grey-out">amplifier 2</option> </select> <select required="" autofocus="" id="cab" name="options" class="select-model"> <option data-value="100" class="disable">cabinet 1</option> <option data-value="200&

javascript - Cant run code and function call passed as string inside settimeout -

i want run code using settimeout. have function: function passing_functions(thefunction) { var my_function ="res="+thefunction+ "(); if (res==true){another_function} " and on call : passing_functions("load_database"); i have string: res = load_database();if (res==true){another_function} ok, i'm unable use inside settimetout settimeout(function() {my_funtion},100} settimeout(function() {my_funtion()},100} settimeout(eval(my_funtion),100} settimeout(my_funtion),100} settimeout(my_funtion()),100} etc --- have error or nothing.... also have tried use "this." prefix "thefunction" without success. could me ? i'm doing wrong ? thanks note: (i want create array of things executed. use passing_functions(load_database); receive code instead function. because i'm using string pass code. ) all "function calls" end } instead of ) or have closing ) somewhere in between. the signa

node.js - Node JS keep getting Failed to load resource error message -

i testing out node.js application , have tried add: <link rel="stylesheet" href="assets/css/formalize.css" /> <script src="assets/js/jquery.formalize.js"></script> to code keeping getting error message: failed load resource: server responded status of 404 (not found) http://localhost:3000/assets/css/formalize.css failed load resource: server responded status of 404 (not found) http://localhost:3000/assets/js/jquery.formalize.js any idea i'm going wrong? here code far (in app.js) var express = require('express'), app = express(), server = require('http').createserver(app), io = require('socket.io').listen(server); server.listen(3000); app.get('/', function(req, res) { res.sendfile(__dirname + '/index.htm'); }); io.sockets.on('connection', function(socket) { socket.on('send message', function(data) { io.sockets.emit('new messag

Android: Determine category of installed apps -

given list of installed packages on android device, there way sort applications categories without using self-compiled hard-coded list of apps in categories? for example, if installed apps phone, angry birds & messages, phone & messages might in communications , angry birds in games. i've seen how category each app on device on android? yet hoped there may method has come along since. no, because apps don't have categories. apps don't need installed through google play, categories on other stores won't same. may never have been installed store begin with- sideload apps time written myself or friends. th concept doesn't exist. not mention google play categories pretty bad- things don't fall 1 or other, descriptions vague, , they're way broad- need @ least 2 or 3 levels of subcategories make them halfway usable.

ruby on rails - Exception while uploading file -

i upgraded rails 3.2 rails 4. uploadind file in form cause typeerror (wrong argument type actiondispatch::http::uploadedfile (expected string)) but commented lines in controller , still error! error appears in post request. trace: https://gist.github.com/mystdeim/6049670 cancan not yet offer rails 4 compatibility, sorry. there few open issues rails 4, eg. cancan activemodel::forbiddenattributeserror rails 4 scoped has been removed in rails 4 master furthermore, ryan bates taking break summer . there other committers, activity very light. don't recommend using cancan in rails 4 project yet.

ios - Custom transition between UIViewControllers -

i've changed app being tabview driven collectionview driven, there many sections of app feasible tabview. when start app presented several items in collectionview , selecting of these items take relevant section of app. in xcode, collection view lives in own storyboard , each section of app has own storyboard. in collectionview's didselectitematindexpath, launch relevant starboard follows; uistoryboard *storyboard = [uistoryboard storyboardwithname:@"relevant_storyboard" bundle:nil]; uiviewcontroller* vc = [storyboard instantiateinitialviewcontroller]; [self presentviewcontroller:vc animated:yes completion:nil]; now, none of built-in transition animations suit launching collectionview, i'd custom effect, such zoom in. however, i'm struggling find decent examples work me create kind of custom transition. i've tried [uiview transitionfromview] , don't think suits transitioning between uiviewcontrollers. i've tried transitionfromviewco

php - How do I get fwrite() to not print to the page? -

i'm using fwrite() write file, however, every time runs, prints of information webpage it's on , writes file, too. i'd rather not echo page. alright, i've retrieved code. here is: fwrite($data_file, "confirmation data: \r\n\r\n song: " . $input_song . "\r\nfile1: " . $file_var1 . "\r\nfile2: " . $file_var2 . "\r\nfile3: " . $file_var3 . "\r\nfile4: " . $file_var4 . "\r\nexplanation text: " . $input_explanation); whenever run this, outputs in second place of fwrite() onto page, outputs follow onto page, except variables replaced values: confirmation data: \r\n\r\n song: " . $input_song . "\r\nfile1: " . $file_var1 . "\r\nfile2: " . $file_var2 . "\r\nfile3: " . $file_var3 . "\r\nfile4: " . $file_var4 . "\r\nexplanation text: " . $input_explanation you should post code, can follow echoing out code html in php file , why prints out on scr

c# - Passing dictionary of colours to view MVC -

i trying retrieve dictionary of colours on model view. getting error dictionary of colours can't serialized. in model create list follows. public dictionary<int, color> colourlist = new dictionary<int, color>(); i create list in model public dictionary<int, color> createcolourpalette() { colourlist.add(1, system.drawing.colortranslator.fromhtml("#f2dcdb")); colourlist.add(2, system.drawing.colortranslator.fromhtml("#e6b8b7")); colourlist.add(3, system.drawing.colortranslator.fromhtml("#da9694")); colourlist.add(4, system.drawing.colortranslator.fromhtml("#c20046")); colourlist.add(5, system.drawing.colortranslator.fromhtml("#d8e4bc")); colourlist.add(6, system.drawing.colortranslator.fromhtml("#c4d79b")); colourlist.add(7, system.drawing.colortranslator.fromhtml("#76933c")); colourli

Sending an action to a view in Ember.js -

i have view contains close button: .flash-message div class="close-button" click="view.removeflash" = view view.content.thisview the view reads: whistlr.alertview = ember.view.extend templatename: "_alert" removeflash: -> alert "close!" however, when click on "close-button" div, nothing happens. i've tried rewriting button few different ways: click="view.removeflash" click="removeflash" click="removeflash" target="view" i've tried placing action directly in controller (though i'm not sure there controller view): whistlr.alertcontroller = ember.objectcontroller.extend removeflash: -> alert "i work!" none of these approaches work. perhaps it's not possible send action view controller? if not, how else can approach problem? the syntax sending events views is, {{action myevent target="view"}} . myevent handler i

objective c - Going from numerical month to Gregorian name for month -

currently i'm using following code acquire date date picker. right now, when nslog nsdatecomponents var, numberical representation month (i.e. 7 july). how can print out month name, day of week, saturday? nsdate *selecteddate = _datepicker.date; nsdateformatter *df = [[nsdateformatter alloc] init]; [df setdateformat:@"mm:dd:hh:mm"]; nsdatecomponents *components = [[nscalendar currentcalendar] components:nsdaycalendarunit | nsmonthcalendarunit | nsyearcalendarunit fromdate:_datepicker.date]; nslog(@"components: %@",components); use format strings eeee day of week, , mmmm month of year in nsdateformatter .

javascript - Always keep caret in the vertical middle of a textarea -

is possible keep caret in vertical middle of textarea. live example focus mode of ia writer : when in mode, caret in vertical middle, , create new line, textarea scrolls little keep caret in middle. i guess should done js, , it's fine me. try playing css line-height .something { font-size: 16px; line-height: 18px; }

osx - mono iPhoneBackupExtractor.exe -

i'm trying run iphonebackupextracter software on mac osx 10.8.4. downloaded latest version web site. , when run mono iphonebackupextractor.exe error. tried searching solution on mono's support site no luck. below full error message. appreciate help. an unhandled error occurred creating main form. if running under os x, due problem x11 installation. please contact support@iphonebackupextractor.com help. error follows: system.typeinitializationexception: exception thrown type initializer system.windows.forms.windowsformssynchronizationcontext ---> system.typeinitializationexception: exception thrown type initializer system.windows.forms.themeengine ---> system.argumentexception: requested fontfamily not found [gdi+ status: fontfamilynotfound] @ system.drawing.gdiplus.checkstatus (status status) [0x00000] in <filename unknown>:0 @ system.drawing.fontfamily..ctor (genericfontfamilies genericfamily) [0x00000] in <filename unknown>:0 @ (wrapper rem

python - Regex multiline- How to grab a portion of a page source -

sorry if question has been brought before, find python regex documentation quite hard understand due lack of examples. want grab block of page source later parsed again. example: <div id="viewed"><div class="shortstory-block"> <div class="shortstoey-block-image"> <a href="...."><img src="/uploads/posts/cov.jpg" alt="instance 1"/></a> <span class="format"><a href="http://www..../">something</a></span> </div> <a href="http://....."><span class="shortstory-block-title" style="text-decoration:none !important;"> </span> </a> </div><div class="shortstory-block"> <div class="shortstoey-block-image"> <a href="...."><img src="/uploads/posts/cov.jpg" alt="som

android - What does new Foo(bar) {public void baz(){....} }; mean in Java? -

i'm trying understand navigationdrawer sample android sdk , met this: actionbardrawertoggle mdrawertoggle = new actionbardrawertoggle( this, /* host activity */ mdrawerlayout, /* drawerlayout object */ r.drawable.ic_drawer, /* nav drawer image replace 'up' caret */ r.string.drawer_open, /* "open drawer" description accessibility */ r.string.drawer_close /* "close drawer" description accessibility */ ) { public void ondrawerclosed(view view) { getactionbar().settitle(mtitle); invalidateoptionsmenu(); // creates call onprepareoptionsmenu() } public void ondraweropened(view drawerview) { getactionbar().settitle(mdrawertitle); invalidateoptionsmenu(); // creates call onprepareoptionsmenu() } }; when these methods called, right after instantiation? i'm not familiar

How to remove every other element of an array in python? (The inverse of np.repeat()?) -

if have array x, , np.repeat(x,2) , i'm practically duplicating array. >>> x = np.array([1,2,3,4]) >>> np.repeat(x, 2) array([1, 1, 2, 2, 3, 3, 4, 4]) how can opposite end original array? it should work random array y: >>> y = np.array([1,7,9,2,2,8,5,3,4]) how can delete every other element end following? array([7, 2, 8, 3]) y[1::2] should job. here second element chosen indexing 1, , taken @ interval of 2.

java - unable to connect to remote database located on server -

i trying update database table hosted on server through mysql jdbc connector using eclipse. class.forname("com.mysql.jdbc.driver"); string url = "jdbc:mysql://49.**.***.115:3306/databasename"; string name = "user"; string password = "passs"; but not able connect database local machine. checked information provided above correct. can please tell me next? here error: com.mysql.jdbc.exceptions.jdbc4.communicationsexception: communications link failure last packet sent server 0 milliseconds ago. driver has not received packets server. @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) @ sun.reflect.nativeconstructoraccessorimpl.newinstance(unknown source) @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(unknown source) @ java.lang.reflect.constructor.newinstance(unknown source) @ com.mysql.jdbc.util.handlenewinstance(util.java:411) @ com.mysql.jdbc.sqlerror.createcommunicationsexc

javascript events - HTML5 Detect Entering Fullscreen -

i cannot seem figure out how bring element fullscreen mode upon video entering fullscreen mode. tried looking through various materials available still answer eludes me. have far: document.getelementbyid("videoid").addeventlistener("mozfullscreenchange", function () { document.getelementbyid("imageid").mozrequestfullscreen(); }, false); the code firefox assume other browsers have similar behavior prefix have switched "moz" "webkit". thank help. as said in comments, there can't 2 fullscreen elements @ once. code should work: document.getelementbyid("videoid").addeventlistener("mozfullscreenchange", function () { if(document.mozfullscreen){ document.mozcancelfullscreen(); document.getelementbyid("imageid").mozrequestfullscreen(); } }, false);

html - Multiple nested CSS menu, stretched vertically -

here css menu: http://www.devinrolsen.com/wp-content/themes/dolsen/demos/css/infinite-sub-menu/ as can see, perfect, deeply-nested - not 100% widthed. want 100% stretched. if there 4 menu items, width must 25% each. have done far: <ul> <li>menu item</li> <li> expandable ↓ <ul> <li>menu</li> <li>menu item</li> <li>menu item long <ul> <li>menu item long nested1</li> <li>menu item long nested2</li> </ul> </li> </ul> </li> <li>e <ul> <li>a</li> <li>b</li> <li>c</li> <li>d</li> </ul> </l

android - App is Force Closing but I can't figure out why -

i can't emulator working on slow computer have go through process of loading app physical device. compiles fine , can't notice obvious error doesn't want run. started happening after followed tutorial on how go page another. looks in comparison tutorial. manifest file <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.mcesfireassist" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="10" android:targetsdkversion="17" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" android:hardwareaccelerated="false"> <activity andr

ruby on rails 3 - simple search within an array -

i want able search within micropost model. microposts have artist , song attributes. tagging these microposts use acts_as_taggable gem. micropost model: def self.search(search) arel = order('created_at') arel = arel.where('upper(artist) upper(?) or upper(song) upper(?)', "%#{search}%", "%#{search}%").order('created_at') if search.present? arel end this code allows me search artist , song how can search tags? micropost.find(1).tags returns [#actsastaggableon::tag id: 18, name: "rock", #actsastaggableon::tag id: 3, name: "rap"] micropost.find(1).tags.map(&:name) returns array ["rock", "rap"] how can query micropost's tags isn't in it's table artist , song? thank you. something adding where() like? where(self.tags.map(&:name), 'like upper(?)', "%#{search}%") can include link gem you're using? there few out there. 1 has built in: h

Android Spinner is empty -

there no errors in code. works fine except spinner isn't populated database expected. rather, empty. please help!! retrieve records sqlite: // contacts public list getallnames() { list names = new arraylist(); // select query string selectquery = "select * " + table_name; sqlitedatabase db = this.getreadabledatabase(); cursor cursor = db.rawquery(selectquery, null); // looping through rows , adding list if (cursor.movetofirst()) { { names.add(cursor.getstring(1)); } while (cursor.movetonext()); } // closing connection db.close(); // returning contacts return names; } load spinner: private void loadspinnerdata() { // database handler databasehandler db = new databasehandler(getapplicationcontext()); // spinner drop down elements list<string> contacts = db.getallnames(); // creating adapter spinner arrayadapter<string> dataadapter = new arrayadapter<string>(this, android.r.layout.simple_spinner_item, contac

ios - Assertion failure when trying to write data to Keychain -

i trying write array data keychain using code below // set keychain can write it... or read if needed (specially testing) keychainitemwrapper* keychain = [[keychainitemwrapper alloc] initwithidentifier:@"keykeychain" accessgroup:nil]; // write nsdata *dataarr = [nskeyedarchiver archiveddatawithrootobject:parsedremotesitesmutablearray]; [keychain setobject:dataarr forkey:(__bridge id)(ksecattrgeneric)]; // read nsdata *myarr = [keychain objectforkey:(__bridge id)(ksecattrgeneric)]; nsarray *arraycopy = [nskeyedunarchiver unarchiveobjectwithdata:myarr]; // log nslog(@"%@", arraycopy); as can see converting nsarray nsdata trying store nsdata ksecattrgeneric reciving error below when tri setobject:forkey assertion failure in -[keychainitemwrapper writetokeychain], /users/imac/documents/iphone applications/appname/appname/keychainitemwrapper.m:268 2013-07-22 13:54:39.952 key[2167:907] *** terminating app due uncaught excep

JavaScript is enabled in client browser in django or in python? -

i trying find solution detect if clients brower has javascript enabled or not. there way check whether javascript enabled in client browser, in django if possible or in python? unfortunately, can't unless trying second request. there's no way know before interacting browser itself. the closest can think of trying set cookie , store information future visits. hope helps.

Android widget avoid updating -

i building static android widget, means widget doesn't need updated @ all. thing widget need handle open link browser when triggered. in appwidgetproviderinfo metadata xml file, there 1 attribute called "updateperiodmillis", , should set value there? or don't add attribute? thanks why not override onupdate() in appwidgetprovider class , have nothing. public class mywidget extends appwidgetprovider { @override public void onupdate(context context, appwidgetmanager appwidgetmanager, int[] appwidgetids) { //do nothing } }

php - Wordpress Shortcode to call latest posts -

i created custom page template display latest 12 posts respective title , excerpt, tought easier if call shortcode. this loop in "post-grid.php" calls 3 things. <section class="post-grid"> <?php $grid = array('post_per_page' => 12); $query = new wp_query( $grid ); while ( $query->have_posts() ) : $query->the_post(); ?> <div class="grid-posts"> <h2><?php the_title(); ?></h2><br> <?php the_post_thumbnail('featured'); ?><br> <?php the_excerpt() ?><br> </div> <?php endwhile; // end of loop. ?> </section> how can create shortcode executes loop? i know how add shortcode using add_shortcode('postgrid', 'postgrid'); function postgrid() { //code here } but im not sure how implement above function. appreciate help! <?php $args = array( 'post_type' => &#

CSS text-overflow: ellipsis; not working? -

i don't know why simple css isn't working... css: .app { height: 18px; width: 140px; padding: 0; overflow: hidden; position: relative; margin: 0 5px 0 5px; font: bold 15px/18px arial; text-align: center; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; color: #fff; } html: <div class="app"> <img src=""></img> <h1></h1> <a href=""></a> </div> text-overflow:ellipsis; works when following true: the element's width must constrained in px (pixels). width in % (percentage) won't work. the element must have overflow:hidden , white-space:nowrap set. the reason you're having problems here because width of a element isn't constrained. have width setting, because element set display:inline (i.e. default) ignoring it, , nothing else constraining width either. you can fix doing 1

eclipse - IBM Worklight 5.0.6 - Where to find the 5.0.6 repository? -

i trying install worklight 5.0.6 ibm update site in eclipse using "install new software", cannot choose version, latest - 6.0.0. project works @ 5.0.6. how install version? see question download links of previous releases (5.0.6.2, 6.0.0.2) , current release (6.1.0.0): ibm worklight - find previous releases the ibm repository site contain latest version. perhaps should open question, detailing not working in project when imported worklight 6.0, solve problem.

c++ - FILE_FLAG_NO_BUFFERING with overlapped I/O - bytes read zero -

i observe weird behavior while using flag file_flag_no_buffering overlapped i/o. invoke series of readfile() function calls , query statuses later using getoverlappedresult(). the weird behavior speaking of though file handles , readfile() calls returned without bad error(except error_io_pending expected), 'bytes read' value returned getoverlappedresult() call 0 of files, , each time run code - different set of files. if remove file_flag_no_buffering, things start working , no bytes read value zero. here how have implemented overlapped i/o code file_flag_no_buffering. long overlappedio(std::vector<std::string> &filepathnamevectorref) { long totalbytesread = 0; dword bytesread = 0; dword bytestoread = 0; std::map<handle, overlapped> handlemap; handle handle = invalid_handle_value; dword accessmode = generic_read; dword sharemode = 0; dword createdisposition = open_existing; dword flags = file_flag_overlapped | fil

excel - Merge the cell values if duplicates exist -

i want merge values in column b if duplicates exist in column a b 123 123 b 123 c 456 d 456 e 789 f my output should this b 123 b c 456 d e 789 f i have large amount of data , hard manually ,so u guys have idea in macros in excel? any appreciated..thanks in advance in case want resultant data in same cells original data existed ie not in cell 10, have store source data in 2 dimensional array. array have use above code insert data in same place original data existed. here goes listing accomplish task: private sub worksheet_beforedoubleclick(byval target range, cancel boolean) dim names(2 7, 2) = 2 7 names(i, 1) = cells(i, 1) names(i, 2) = cells(i, 2) next on error resume next: sheet1.cells.clear cnt = 2 = 2 7 strg = strg + names(i, 2) if names(i + 1, 1) <> names(i, 1) cells(cnt, 1) = names(i, 1) cells(cnt, 2) = strg cnt = cnt + 1 strg = "" end if next end sub

java - Disable Spring Security (ldap auth) Temporarily -

i have simple web application, username , password (entered in login page) authenticated against ldap using spring security. almost configuration here. can post config. files if necessary. i need way disable authentication altogether temporarily purpose of demo/testing etc. ideally if 'do not authenticate' checkbox exists on login page, authentication should bypassed. ofcourse can remove spring-security stuff. not neat. what simplest/best way this? thanks. i know year old, ran across wanting exact same thing. not find way dynamically did find way simple change done on 1 line in config.groovy , restart of app worked me. grails.plugin.springsecurity.ldap.active = false and put other ldap config options in if statement if (grails.plugin.springsecurity.ldap.active) { //all of ldap options }

Javascript inheritance by "extend" -

can't undestand javascript inheritanse using "extend" function. i try this var extend = function (protoprops, staticprops) { var base = this; if (protoprops) { (var prop in protoprops) { base.prototype[prop] = protoprops[prop]; } } if (staticprops) { (var prop in staticprops) { base[prop] = staticprops[prop]; } } return base; }; var view = function (attributes) { var _self = this; attributes = attributes || {}; this.renderto = function (elem, data) { var compiled = _.template(_self.template); var rendered = compiled(data); $(elem).append(rendered); }; }; view.extend = view.prototype.extend = extend; var reportssublayoutview = view.extend({ template: templates.reports.sublayout //first template }); var reportsperiodsectionview = view.extend({ template: templates.reports.periodsection // second template }); var reportssublayoutvi

Thread Window in Visual Studio Express 2012 Desktop Edition -

i migrated project files new system , i'm using visual studio 2012 express edition desktop (earlier using visual studio 2010 professional). i'm not able thread window in debugger navigating onto debug->windows->threads . how find thread window in visual studio 2012 express edition . you can find going quick launch bar on upper right corner of ui or pressing ctrl+q. search "threads". should see search result threads window.

java - Spring MongoDB Criteria update -

how can write query update "contacts.collection.value._class = subclass2" , set value xyz spring mongodb criteria? { "_class" : "myclass", "_id" : objectid( "51ecc95503644e4489bb742e" ), "contacts" : [ { "property1" : "value1", "property2" : "value2", "collection" : [ { "value" : "1", "_class" : "subclass1" }, { "value" : "2", "_class" : "subclass2" }, { "value" : "2", "_class" : "subclass3" }, i trying spring data mongo criteria class. so far got it's not working query = new query(criteria.where("_id").is(myclassid) .and("contacts.collection.value").is("2") .and("contacts.collecti

Javascript doesn't load PHP function in codeigniter, but does in pure PHP environment -

i have file.html tries call neg.php when image clicked (there many <p class="bagi"> . <p class ="bagi"> <a href="try.html" onclick="return false;"> <img src="images/neg.png" title ="rate negative" onclick="negative(this);"> try try try try try </a> </p> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript"> function negative(obj) { var url = obj.parentnode.valueof('href'); var name = obj.parentnode.innertext; alert(url); $("#quote p").load("neg.php?url="+ url + "&name=" + name); } </script> <div id="quote"><p></p></div> the neg.php , located in same folder code above, , write text file subfolder cat/nonstatistics ,

android - Getting Direct File Links from Dropbox -

is there way "direct file links" dropbox in android code without using dropbox api's? i searched lot on did not find solution. responses appreciated. get file link exemple https://www.dropbox.com/s/blablabla/test.pdf replace www dl add ?dl=1 end result of our example: https://dl.dropbox.com/s/blablabla/test.pdf?dl=1

to creating custom toolbar in magento get error Call to a member function setCurPage() on a non-object -

i display manufacturer image slider on home page block. there put view link, on clicking link display manufacurer in new pahe category page. created manufacturer.php under <?php class bc_manufacturer_block_manufacturerpage extends mage_core_block_template { public function _preparelayout() { return parent::_preparelayout(); } public function getmanufacturer() { if (!$this->hasdata('manufacturer')) { $this->setdata('manufacturer', mage::registry('manufacturer')); } return $this->getdata('manufacturer'); } public function gettoolbarhtml() { $this->settoolbar($this->getlayout()->createblock('catalog/product_list_toolbar', 'toolbar')); $toolbar = $this->gettoolbar(); $toolbar->enableexpanded(); $toolbar->setavailableorders(array( 'ordered_qty' => $this->__('position'), 'name' => $this->__(

Zoom specific element on webcontent (HTML,CSS,JavaScript) -

Image
i want zoom specific element of website (a div), if user zooms website on mobile device. following picture shows idea: as can see, test zoomed top div stays same size; div contains test zoomed / scaled. could give me tips on how achieve this? don't know start. update: http://jsfiddle.net/wyqsf/ . if zoom in on page, scale both elements. want adjust content element when zooming. 1 way can think of achieve retrieve user-input , use javascript adjust div's width contradictory usual behavior. pseudo-code: container.mousemove { content.changewidth();.. } in order this, need fix user's viewport cannot pinch zoom page, , use touch events library hammer.js attach callback pinch zoom gesture appropriately resizes element on page you'd scale. viewport fixing happens in head element of html: <meta name="viewport" content="width=device-width, maximum-scale=1.0"> you use hammer.js detect "pinch zoom" gesture, , l