Posts

Showing posts from January, 2011

c++ - why doesn't clang++ compile the following code? -

i have following code: #include <type_traits> int main() { } g++ file.cc -std=c++0x works fine. however, need use clang++ reason. when try clang++ file.cc -std=c++0x i bunch of errors: in file included file.cc:1: in file included /usr/include/c++/4.4.4/type_traits:50: /usr/include/c++/4.4.4/tr1_impl/type_traits:230:41: error: expected ')' struct is_function<_res(_argtypes......)> ^ /usr/include/c++/4.4.4/tr1_impl/type_traits:230:28: note: match '(' struct is_function<_res(_argtypes......)> ^ /usr/include/c++/4.4.4/tr1_impl/type_traits:230:12: error: redefinition of 'is_function<type-parameter-0-0 (type-parameter-0-1, ...)>' struct is_function<_res(_argtypes......)> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/4.4.4/tr1_impl/type_traits:227:12: note: previous definition here struct is_function<_res(_argtypes......

database - How to get the commands and table that deadlocked in Oracle? -

i want deadlocked tables/column, , commands locked table/column. has way? the oracle view v$lock contains details of locks @ time. the id1 value map dba_objects.object_id. you need granted select on these views if not have dba access. more details here , here

php - Make something appear only on first page in Wordpress -

how can make banner appear on index page of wordpress theme when click second or other page pagination of recent posts not want appear. suggestions? thanks you can use conditional is_paged() if( !is_paged() ) { // show wanna show } it's going show on first page, on page 2, 3, 4... it's not going show.

javascript - Display select fields using conditional statements in JS -

i designing self-service site people problems accessing secure website. want generate drop downs questions situation based on answers each previous drop down box. trying use js , conditional statements accomplish this. not programmer understand enough reverse engineer it. here's have far. <select id="location" name="location" onclick='test()'> <option value="0">is personal computer or government computer?</option> <option value="home">personal</option> <option value="gfe">government</option> </select> <select id="home" name="home" style="display: none" onclick='test()'> <option value="0">do have cac?</option> <option value="1">yes</option> <option value="2">no</option> </select> <select id="multi-cac" name="multi-cac" s...

ios - How to generate random letters as per the word -

i’m developing word puzzle game,where 1 word given.according word random letters generated…for that, applied below logic how random letters not generated per given word. nsmutablearray *arrofabcd = [[nsmutablearray alloc] initwithobjects:@"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", nil]; float x = 70; float y = 100; float width = 30; float height = 20; for(int =0;i<32;i++) { nsuinteger randomindex = arc4random() %(arrofabcd.count); uibutton *btnletter = [uibutton buttonwithtype:uibuttontyperoundedrect]; [btnletter setframe:cgrectmake(x, y, width, height)]; [btnletter settitle:[nsstring stringwit...

getStringExtra - Public Static Final - The Busy Coder's Guide to Android -

i on page 301 of book , example of activity getting "extras" intent started it. new java maybe missing pretty obvious but... thought when declare variable "final" meant doesn't change. there line of code initialising final variable: public static final string extra_message="msg"; and later in oncreate method: tv.settext(getintent().getstringextra(extra_message)); the text displayed in activity not "msg" string passed intent "i other activity". why have have variable declaration above code work? don't understand doing. thanks you getting extra received activity indexed key 'msg'. like when intent used start activity : intent.putextra("msg", "text going in textview"); the key 'msg', value textview 'text going in textview'

php - Yii rest api insert data in database -

i have problem rest service. i'm new programmer in yii framework , did not create service before. code next: my controller: public function actionlist() { $model=new entryfile; if($_post) { $init = cjson::decode(file_get_contents('php://input')); $model->attributes=$init['input']; $model->eetype=($model->eetype); $model->eesize=($model->eesize); $model->eefilename=($model->eefilename); $model->eefilechecksum=($model->eefilechecksum); $model->eeentrypath=($model->eeentrypath); } $model=new outputfile; if($_post) { $init = cjson::decode(file_get_contents('php://input')); $model->attributes=$init['output']; $model->ofname=($model->ofname); $model->ofd...

javascript - How to access variable values from jstl foreach to jQuery -

hello guys may easy question m finding quite tricky. scenario m printing values database table using jstl foreach. <c:foreach items="${pal}" var="p"> <tr> <td><c:out value="${p.pid}"></c:out></td> <td><c:out value="${p.pname}"></c:out></td> <td><c:out value="${p.pdesc}"></c:out></td> <td><c:out value="${p.pestd}"></c:out></td> <td><a id="popa" href="#">allocate</a></td> </tr> </c:foreach> and onclick allocate button want particular pid (i.e suppose there 1,2,3,...,10 pid when click on 4th should 4th pid value) in jquery. but in jquery when try value got last value in loop whichever button click. in jquery section $("a#popa").click(function(){ var input = $("<c:out value='${pi...

css - Restrict a click to a specific shape -

Image
i have image/polygon defined in css this: .post-wrapper { position: relative; width: 250px; height: 420px; float: left; background-color: #ddc; -webkit-clip-path: polygon(50% 100%, 100% 50%, 50% 0, 0 50%); -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } you can see image: it defines sort of rectangle, clickable image redirects page, , people able click in part of rectangle want them click on polygon. knows how can here in code? fidde css solution you may maintain boundaries of diamond shape , make part image clickable using css transform properties. point use skew property link actualy has diamond shape , therefore isn't clickable outside shape (see following demo , screenshot). then, need "counter transform" content isn't skewed. demo screenshot : relevant css : a{ width: 216px; height: 250px; overflow:hidden; ...

javascript - jquery not recognizing $(this) -

i have following html , javascript: html: <div class="container"> <div class="row"> <div class="col-md-6 col-md-offset-3"> <div class="well"> <form id="registration-form" class="text-center" method="post" role="form"> <h1>registro</h1> <hr> <div class="form-group"> <label class="control-label" for="username">nombre de usuario</label> <input type="text" class="form-control" placeholder="nombre" name="username" id="username" autofocus> </div> <div class="form-group"> <label class="control-label" for="useremail">correo</label> <input type="email" class="form-control" placeholder="corr...

eclipse - Android Native C Code not recognized -

hey guys have real weird issue time. i reinstalled adt on new computer. native c includes recognized eclipse , code compiles no errors nor warnings. when make slightest change code, lines including methods native libraries become "unresolved". restarting eclipse solves this, until next edit. editing java files ok, when edit c code becomes unrecognizable eclipse. please help, restarting eclipse before every compilation not fun... thanks, ben.

colors - OpenGL normal blending with black alpha edges -

Image
i have problem blending text. it's not text problem global blending problem alpha value. i tried 2 different blending function on image (text image too). function glblend different first parameter. (i know how glblend func works) there black pixels around text , it's around every alpha image smooth alpha edges. doesn't seem text :/ the result parameter gl_one want can't make text fade alpha value. so question is: is there way how result gl_one parameter using source alpha value of image? with parameter source alpha of image isn't used can't transparent. want animate image this: i need use gl_src_alpha function because need use source alpha. tried increase color values fragment shader result similar gl_one blending don't want change original colors. any help? thanks. edit: there page blending functions can try , better understand mean: http://www.andersriggelsen.dk/glblendfunc.php

Why don't junit tests get executed with "sbt test"? -

i using sbt version 0.13.2 pure java project. my build.sbt has following line in it: librarydependencies ++= seq("com.novocode" % "junit-interface" % "0.10" % "test") my test looks this: import org.junit.test; import org.junit.before; import org.junit.runner.runwith; import org.junit.runners.junit4; import org.junit.assert.*; @runwith(junit4.class) public class exampletest{ @test public void firsttest(){ org.junit.assert.assertequals("2.5 + 7.5 = 10.0", 2.5 + 7.5, 10.0, .1); } } when sbt test command line, test compiled, test not run. says compiling 1 java source [my path]/target/scala-2.10/test-classes... ... [info] passed: total 0, failed 0, errors 0, passed 0 [success] total time: 1 s, completed may 31, 2014 5:56:22 pm any idea how test executed? when remove @runwith annotation, tests run fine. don't know why resolved problem.

angularjs - What is the proper module/directive/filter/etc syntax in angular? -

i've seen modules, , directives, filters, etc defined in modules, written different ways , curious if there benefit 1 on other. for example, have module defining directive in looks this: var app = angular.module('app', []); app.directive('mydirective', function() { return { restrict: 'e', template: '<a href="http://google.com">google</a>' } }); but see written following lot, directive definition inside the module: angular.module('app', []) .directive('mydirective', function() { return { restrict: 'e', template: '<a href="http://google.com">google</a>' } }); which way better? thanks! it's same. module(name,dependencies) returns module defined.the difference between 2 in first exemple put module variable.which in exemple 1 unnecessary. but see written following lot, directive definition insi...

c# - Complex Query LINQ Lambda -

i trying extract data in single query. since involves many tables, sort of stuck @ grouping part. i not have enough reputation post image of table design. so, giving pk,fk sector (sectorid) device (deviceid:pk, categoryid:fk) ratio (sectorid,deviceid) use (useid) deviceuse (sectorid,deviceid,useid) family (familyid) category (categoryid) level (levelid) age(ageid) consu (sectorid,deviceid,levelid) distributionone (sectorid,deviceid,levelid) distributiontwo (sectorid,deviceid,levelid, ageid) what trying achieve is: given sectorid , retrieve related information tables given. the result be: all devices grouped family grouped category and ratios (for given sectorid , deviceid ) and deviceuses (for related sectorid , deviceid ) , related use deviceid and consu (for related deviceid , levelid , ageid ) , related age , level and distributionone (for related deviceid , levelid , sectorid ) , related level and distributiontwo (for related ...

javascript - How to prevent entire user models from leaking up into the jade template -

i working on log in portion of project working express, passport-local , mongoose. have set of routes: module.exports = function (app) { app.get('/', function (req, res) { res.render('index', { user : req.user, title : "home" }); }); app.get('/register', function(req, res) { res.render('register', { }); }); app.post('/register', function(req, res) { athlete.register(new athlete({ username: req.param('username'), firstname: req.param('firstname'), lastname: req.param('lastname'), dob: req.param('dob') }), req.param('password'), function(err, athlete) { if (err) { console.log(err); return res.render('register'); } res.redirect('/'); }); }); app.get('/login', function(req, res) {...

ember.js - Ember observer not getting most recent value -

i'm trying observe controller property in associated view, when so, old value. know async issues observers, per: http://emberjs.com/guides/object-model/observers/ but using run.once() doesn't seem help. here's code: mycontroller = ember.controller.extend({ testproperty: false, otherthingwatcher: function() { this.set('testproperty', true); console.log(this.get('testproperty')); // outputs true when someotherthing changes. }.observes('someotherthing'); }); myview = ember.view.extend({ checktestproperty: function() { console.log(this.get('controller.testproperty')); // ack! false! var = this; ember.run.once(this, function() { console.log(this.get('controller.testproperty')); // same thing. }); }.observes('controller.testproperty'); }); what have missed? versions: debug: ember : 1.5.1 ember.js:3521 debug: ember data : 1.0.0-beta.8+canary.503c75c9 ember.js:352...

java - Post requests are not working properly with JMeter -

i have page contains list of posts, each post has comment link, onclick of it shows text area (with javascript) , user fills textarea , presses enter post comment (with ajax), , here form data see in browser after posting comment: feedform:feedform feedform:j_idt221:0:j_idt222:j_idt286:commenttext:hi feedform:j_idt221:1:j_idt222:j_idt286:commenttext: javax.faces.viewstate:-1278084094245361929:-1028657209799449340 javax.faces.source:feedform:j_idt221:0:j_idt222:j_idt286:commenttext javax.faces.partial.event:keypress javax.faces.partial.execute:feedform:j_idt221:0:j_idt222:j_idt286:commenttext feedform:j_idt221:0:j_idt222:j_idt286:commenttext javax.faces.partial.render:feedform:j_idt221:0:j_idt222:j_idt286:commenttext feedform:j_idt221:0:j_idt222:j_idt286:feedcomments javax.faces.behavior.event:keypress javax.faces.partial.ajax:true what did created post http request in jmeter , added above form data parameters, , when running test plan, no errors,but comment not added. here...

How to prevent SQL injection in Laravel? -

in controller have code: public function create($brand_id) { brand::findorfail($brand_id); } and this: public function search() { $q = input::get('q'); $brands = brand::where('title', 'like', '%'.$q.'%')->take(80)->get(); is code safe? "safe" mean sql injection safe. or should variable clean here? , best way cleaning user input? lot helping me :) yes eloquent uses parameter behind behind scene, safely escapes input used in where().

android - Button is not visible in device -

hi using using below layout code display title @ top [fixed], text in center [scrollable] , 2 button in bottom [fixed]. i.e. ----------------------- | header | |-----------------------| | | | content goes here | | (scrollbale) | | | | | | | |-----------------------| | button 1 | button 2 | ------------------------- i using below code generate above layout: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layout_root" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/intouch_full_border" android:orientation="vertical" > <textview android:id="@+id/title" android:layout_width=...

jetbrains - dotTrace cant create deploy folder on Windows Azure Web Sites (WAWS) -

i error message 'can't create deploy folder.' when try profile remote websites on waws. actions taken: downloaded , installed dottrace profiler 5.5 jetbrains website downloaded dottrace.performance.remote version 5.5.0 nuget published website waws via visual studio 2013 started dottrace application administrator connected remote _https://subdomain.azurwebsites.net/agentservice.asmx. see image: http://1drv.ms/1nf5cyh selected w3wp process , pressed run got error message 'can't create deploy folder'. see image: http://1drv.ms/u5h35a i'm running dottrace in trial mode @ moment. swift appreciated. orhan this not supported yet (june 2014), work being done support ready.

VB.Net - Button Style Modification -

i ask how buttonstyle called in .net: http://i.stack.imgur.com/gvnuo.png and how color borders gray? should in image. that "flatstyle" button, can set style, text colour, border colour , mouse-over colour so: button1.flatstyle = flatstyle.flat button1.forecolor = system.drawing.color.black button1.flatappearance.bordercolor = system.drawing.color.gray button1.flatappearance.mouseoverbackcolor = system.drawing.color.lightgray

powershell - Update SharePoint Online columns/content types with CSOM -

i have following csom script update site columns , push down changes: add-type -path "libraries\microsoft.sharepoint.client.dll" add-type -path "libraries\microsoft.sharepoint.client.runtime.dll" $weburl = "enter_url_here" $username = "enter_username_here" $password = "enter_password_here" $securepass = convertto-securestring $password -asplaintext -force $ctx = new-object microsoft.sharepoint.client.clientcontext($weburl) $ctx.credentials = new-object microsoft.sharepoint.client.sharepointonlinecredentials($username, $securepass) #add description "other category" field $fieldtitle = "other category" $fielddesc = "search existing name before adding new entries" $field = $ctx.site.rootweb.fields.getbyinternalnameortitle($fieldtitle) $field.description = $fielddesc $field.updateandpushchanges($true) #add description "initiator location" field $field2title = "initiator location...

AngularJS checkbox filter -

i filter results. there list of wines, wish when no checkbox checked, entire list of wine displayed. when 1 checkbox checked displayed related category when more 1 checkbox checked related categories displayed i'm newbie angularjs, tried ng-model wihout success, here code without ng-model associated function: <html ng-app="exampleapp"> <head> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.10/angular.min.js"></script> <script> angular.module("exampleapp", []) .controller("defaultctrl", function ($scope) { $scope.wines = [ { name: "wine a", category: "red" }, { name: "wine b", category: "red" }, { name: "wine c", category: "white" }, { nam...

python - bulk_create for foreign key list giving unexpected output -

bulk_create giving unexpected output , wrong here...???? class user(models.model): first_name = models.charfield(max_length=50) last_name = models.charfield(max_length=50) class messagepost(models.model): send_to = models.foreignkey(user) media_def = models.textfield(blank=true) message = models.textfield() #userlist fetched db userlist = [user(first_name='a',last_name='b'),user(first_name='x',last_name='y')] messagepost.objects.bulk_create([messagepost(send_to=u , media_def='media/images/1.png' , message='hai everyone') u in userlist ]) here on using bulk_create gives following erroneous output : typeerror : expected string or buffer

javascript - Iframe content not loading properly in Firefox and IE -

i have 4 iframes in different 4 tabs. content getting cropped in firefox loading in chrome. when reload iframe content getting loaded properly. having problem. even faced same problem. issue happened because hiding iframes except first one. if make divisions display none, dom not refer contents inside of them. ok. instead of using "display:none", use "visibility:hidden". after changes work. becuase visibility hidden hide visibility, dom load initially. problem can see space occupation on place. what did: each , every tab onclick have refreshed particular div using jquery. have moved script on bottom page. after working fine me. hopefully idea you.

vb.net - Convert 3D plane (front view of a solid) to 2D coordinates (XY plane) -

in program, have solid in top view cut using cutting plane (by drawing line on top view - xy plane). after solid cut using line, have show front face of cut part on xy plane can print diagram of cross section on paper. once have rectangle of cut face (in front view - xz plane) , have transform show in xy plane. how can using vb.net. i saw question here: convert 3d plane 2d , code provided user kieth. solution relevant problem? edit: edit related nico schertler's answer. read on vectors , basic coordinate geometry. how should direction vector? example, cut line cuts solid cube defined by: stpt(-1500, 24038, 0) , edpt(45500, 24038, 0). cut face of solid rectangle: pt1(-350, 24038, 0), pt2(1335, 24038, 0), pt3(1335, 24038, -350) , pt4(-350, 24038, -350). have transform each coordinate of rectangle, lying in xy plane. xz plane. here, direction vector direction of cut line or each edge of rectangle? hope not confusing anyone. you want transform 3d-points local 2d coor...

javascript - AngularJS – $route.reload() not working -

i'm trying reload page using $route.reload() : var app = angular.module("app", ["ngroute"]); var idx = 0; app.controller("list", function ($scope, $route) { $scope.changewallet = function (index) { idx = index; $route.reload(); console.log("success"); }; } "success" shown in console, nothing happens. how can fix this? if want reload complete page instead of route refresh inject $window service , call location.refresh $window.location.reload();

javascript - Loop through different Button Text .onClick -

i'm trying change button text when clicked. right have # script loading button $(document).ready -> $('.loop_button').click -> $(this).html('<i class="fa fa-spinner fa-spin"></i> uploading...'); so when clicked changes fa-spinner icon , uploading... text. how can insert 3 or more strings displayed in button text. like: ["uploading...", "still uploading", "this file huge"] assuming have time intervals want happen, can time-outs. settimeout function execute callback after specified number of milliseconds. so, example: timeouts = [] $('.loop_button').click -> button = $(this) button.html('<i class="fa fa-spinner fa-spin"></i> uploading...') # switch label after 10 seconds... timeouts.push settimeout ( -> button.html('<i class="fa fa-spinner fa-spin"></i> still uploading') ), 10000 ...

ruby on rails - Jenkins + Rspec + Capybara integration test fail -

i've configured ci server jenkins in order run test after each push git. have integration tests , there 1 fails. output given capybara can't find element if run test in local works. i've research bit , found headless gem doesn't work. tried set capybara.default_wait_time = 5 nothing. does know kind of configuration should set in order jenkins green? thank in advance the failure find may element within environment. using 'save_and_open' method show exact state of page trying rendered in ci server environment. can add test as: it 'should register successfully' visit registration_page save_and_open_page fill_in 'username', :with => 'mruser' end this assumes can view page on ci server or alternatively headless version file should saved review later.

omap - Ducati for OMAP5 -

i'm quite familiar ducati framework omap4 . i'd know if there difference in ducati framework omap5 . because, in omap4, had viewed trace logs - trace0 , trace1 . but, in omap5, trace0 available. there not documents available on online. this isn't omap4 vs omap5 difference. ducati subsystem made of 2 arm cortex m cores (2xm3 on omap4, 2xm4 on omap5). initial implementation of rtos (on omap4) did not support smp, each m core running own rtos instance, , own image. each core indeed running different image loaded remoteproc. the trace0 , trace1 refered running cortex m core id, each image using different id. mpu side send messages either 1 or other core, explicitly. the rtos running on ducati cores (aka ti sys/bios) later improved , support smp added. android omap 'releases' transition happened in omap5 timeframe. rtos on omap5 android release running single image aware of 2 cortex m cores, , able schedule tasks on 1 core or other. consequence there si...

parsing - How to compile yacc/bison with multiple files? -

i'd adjust yacc-parser of kconfig-libs ( /<path-to-kconfig>/libs/parser ). i'm having problems resolving various symbols, variables, functions, tokens, etc. guess problem is, compiling not files of kconfig-parser included. here's do: lex lconf.l bison -d -y ./yconf.y gcc -o yconf y.tab.c i error messages like: ./yconf.y 499:44: error: >>rootmenu<< not declared (first use in function) rootmenu.prompt = menu_add_prompt(p_menu, rootmenu, null); ^ ./yconf.y:576:2: error: »zconfnerrs« not declared (first use in function) zconfnerrs++; ^ ./yconf.y:546:3: error: »zconfnerrs« not declared (first use in function) zconfnerrs++; ^ there more files (.c , .h) in directory of parser, (i guess) need included compiler-process: hconf.c, lconf.c util.c symbol.c menu.c expr.c confdata.c, lkc.h lkc_proto.h (but in sourcecode there specific #include commands) i'm using code straight out-of-the-box. when use makef...

javascript - count the download number of zip file -

i want count download number of zip file in web site . in html code link is: <a href="http://www.test.com/download/foo.tar.gz">download zip file</a> how proceed? you can use jquery google analytics track clicks on outgoing links site

linux - bash - two ways to write function syntax -

in bash can write function , have 2 ways ( 2 syntax ) , please advice what differences between example1 example2 or maybe there no differences? function i_love_function { . . } i_love_function () { . . } how call function i_love_function from: http://www.gnu.org/software/bash/manual/bashref.html#shell-functions functions declared using syntax: name () compound-command [ redirections ] or function name [()] compound-command [ redirections ] this defines shell function named name. the reserved word function optional. if function reserved word supplied, parentheses optional .

Laravel 4 Blade Template Array multidimensional -

friends, need show using laravel 4 + blade following array: array (size=2) 'item1' => array (size=5) 0 => string 'a' (length=1) 1 => string 'b' (length=1) 2 => string 'c' (length=1) 3 => string 'd' (length=1) 4 => string 'e' (length=1) 'item2' => array (size=5) 0 => string 'overall result a' (length=48) 1 => string 'overall result b' (length=20) 2 => string 'overall result c' (length=18) 3 => string 'overall result d' (length=43) 4 => string 'overall result e' (length=28) i not able show 2 array in same loop exemple: @foreach($items $item) <div class="track"> <div class="track_citys">{{ $array1 }}</div> <div class="track_points">{{ $array2 }}</div> </div> <div class="clea...

javascript - Binding checked checkboxes to array attribute in Ember.js -

i have form input fields , checkboxes. route looks this: sharedcontentnewroute = ember.route.extend setupcontroller: (controller) -> content = @modelfor("content") controller.set('content', @store.createrecord('shared_content')) controller.set('handles', @store.find("handle")) shared_content model has, among other attributes, handle_ids array attribute needs populated ids of checked checkboxes. template populating checkboxes (available handles) defined within shared_content/new template: ... {{#each handles}} <div class="checkbox"> {{input type="checkbox" id=id}} <label {{bind-attr for="id"}}>{{data.name}}</label> </div> {{/each}} ... the problem need checked checkboxes ids , put them handle_ids attribute of shared_content model (which model template) before model gets saved. there nice solution kind of binding? take @ this http://em...

Android: How to prevent the user from entering a specific character -

hi there way prevent user prevent user form entering specific character in edit field? in mu case want prevent user entering "0". as can see here edittextfield limited digits. <edittext android:id="@+id/edittext1" android:layout_width="50dp" android:layout_height="35dp" android:layout_marginbottom="2dp" android:maxlength="2" android:inputtype="number"> <requestfocus /> </edittext> how can prevent them form entering "0" in field?

c - How do I read a user-specified file in an emscripten compiled library? -

i'm working on file parsing library in c emscripten compile support. takes file path user reads binary file , parses it. i understand emscripten doesn't support direct loading of files, instead uses virtual filesystem. there way load file @ given path virtual filesystem emscripten compiled c lib can read it? i'm looking solutions both nodejs , in browser. if want compile file directly library can use --preload-file or --embed-file option. this: emcc main.cpp -o main.html --preload-file /tmp/my@/home/caiiiycuk/test.file after in c can open file normally: fopen("/home/caiiiycuk/test.file", "rb") or can use emscripten javascript fs-api , example ajax: $.ajax({ url: "/dataurl", type: 'get', beforesend: function (xhr) { xhr.overridemimetype("text/plain; charset=x-user-defined"); }, success: function( data ) { module['fs_createdatafile']("/tmp", "tes...

How to Include JavaScript in PHP -

i supposed include javascript in functions.php file wordpress. tinymce.init({ ... extended_valid_elements : "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]" }); i put in functions.php , didn’t work. doing wrong? echo '<script type="text/javascript">' , 'tinymce.init({ ... extended_valid_elements : "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]" });' , '</script>' ; edit: perhaps if explained trying do. when use wordpress html editor add icons <span class="icon-shield"></span> and switch visual editor , html editor, icons disappear. trying include bit of javascript above fix this. looked @ wp_enqueue_scripts suggested , put in functions.php, still doesn’t fix problem. function oakwood_tinymcefix() { wp_enqueue_script( 'tin...

How to add click event to a iframe with JQuery -

i have iframe on page, coming 3rd party (an ad). i'd fire click event when iframe clicked in (to record in-house stats). like: $('#iframe_id').click(function() { //run function records clicks }); ..based on html of: <iframe id="iframe_id" src="http://something.com"></iframe> i can't seem variation of work. thoughts? there's no 'onclick' event iframe, can try catch click event of document in iframe: document.getelementbyid("iframe_id").contentwindow.document.body.onclick = function() { alert("iframe clicked"); } edit though doesn't solve cross site problem, fyi jquery has been updated play iframes: $('#iframe_id').on('click', function(event) { }); update 1/2015 link iframe explanation has been removed it's no longer available. note code above not work if iframe different domain host page. can still try use hacks mentioned in comments.

anchor - HTML5 — How to link an <article> itself? -

i have article tag: <article> ... </article> and want link clicking anywhere within article (which i've outlined using border) bring user different page. wrapping article in anchor tags doesn't work. how should this?

java - Accepting SQL Query in JSP Form -

what using: postgresql, netbeans, tomcat server, , jsp , html to avoid question duplicate ia mtrying explain cleary :): i connect jdbc driver database uni few tables. trying if user enters query in form please enter query: ............... like select * student or select distinct student.name student natural join transcript join professor using (pid) professor.name = 'artem'; or select semester, year, count(distinct cid) numberofcourses transcript group ..., ... if user entered query should print out result. here stuck , not sure how implement java if want can add code post. accessing database jsp string query = request.getparameter("query"); if(query!=null && !"".equals(query)) { connection con = new dbconnection().getconnection(); statement st = con.createstatement(); resultset rs = st.executequery(query); resultsetmetadata rsmd = rs.getmetadata(); int totalcolumn = rs...

OCaml, default value for Unix.umask -

consider code : #load "unix.cma" ;; print_int (unix.umask 0) ;; print_newline () ;; when run it, 2 (binary : 000.000.010). when run 'sudo', 18 (binary : 000.010.010) expected 0o640 (binary : 110.010.000), standard library says : http://caml.inria.fr/pub/docs/manual-ocaml/libref/unix.html#typefile_perm purpose make directory. if make (unix.umask 0) lor (0o640) it created inaccessible. accurate @ binary numbers gives me idea default mask reverted. so, make directory using : let revert_mask m = let user = (m land 0b000000111) in let group = (m land 0b000111000) lsr 3 in let other = (m land 0b111000000) lsr 6 in (user lsl 6) lor (group lsl 3) lor other ;; then, create directory : let mask = (revert_mask (unix.umask 0)) lor 0o640 ;; print_int mask ;; print_newline () ;; unix.mkdir "foo" mask ;; i 416 (0o640), corresponds ls -l | grep foo : drw-r----- 2 (me) (me) 4096 june 2 19:23 foo however, a cd foo won't work. ...

Why Nginx rejects cURL requests -

when access url example: http://ethiopia.yellowpg.com/listings/et5000-fish-production-marketing-enterprise from browsers works. if try curl doing following curl http://ethiopia.yellowpg.com/listings/et5000-fish-production-marketing-enterprise i following error. <html> <head><title>403 forbidden</title></head> <body bgcolor="white"> <center><h1>403 forbidden</h1></center> <hr><center>nginx/1.4.3</center> </body> </html> how nginx detecting curl request? , there way around problem?

excel - Converting 0 to blank in empty cells -

i trying use vba switch of 0's show in empty cells , make them blank. looking around answer question, closest come this. code did not work, wondering if @ least part of correct. aarray(5) variant range("a1:ap252") = aarray() so once again, want create code change 0's in empty cells , make them blank. thank you. using macro recorder: range("a1:ap252").replace what:="0", replacement:="", lookat:=xlwhole

vb.net - Extract middle name -

i need find out how extract middle name full name displayed in output text box, far can middle name , half last name displayed. main issue having dont know how indexof second space seperates middle , last name. code far: private sub btnclick_click(byval sender system.object, byval e system.eventargs) handles btnclick.click dim fullname, firstname, middlename, lastname string dim n, m integer fullname = txtfullname.text n = fullname.indexof(" ") m = fullname.lastindexof(" ") firstname = fullname.substring(0, n) lastname = fullname.substring(m + 1) middlename = fullname.substring(n, m) txtmiddlename.text = middlename end su once you've found first space, split string 2 strings, 1 before first space , 1 after it. can split second string @ first space extract middle name. i should point out, however, nonsense because makes bogus assumptions how humans named. there first names spaces in them. "mary lou"...

seo - Company name next to website URL -

Image
anyone knows how show company name next url in google search results? not talking google authorship, not know thing called or how go if has idea. look @ image know talking about. in google dont't see arrows , brand names talking about. following document seems usefull me: http://static.googleusercontent.com/media/www.google.com/nl//webmasters/docs/search-engine-optimization-starter-guide.pdf

php - function to check if user text is valid -

i trying make function if user clicks update button , text in textbox valid text(only text array should valid ie. text1, text2, text3). then, echo's number assosiated text in array if text1 entered, should echo 10. made function says invalid argument supplied foreach() on foreach loop line. html: <input type='text' id='usertext' name='usertext' size='15' /> <input type='submit' name='update' id='update' value='update' /> php: public currenttext = 0; $config['text'] = array( 10 => 'text1', 25 => 'text2', 50 => 'text3' ); public function set_text($validtext) { foreach($this->config['text'] $key => $value) { // <-- foreach loop if($key == $validtext){ $this->currenttext = $value; } } } if ($_post['update') { $this->set_text($_post['usertext')); } you may t...

ios7 - iOS UITextView setText EXC_BAD_ACCESS -

i getting exc_bad_access if set text in 'urdu' language txtdetaillandscape.text = @"مير‎"; if set english string, work ok. txtdetaillandscape uitextview in landscape mode weak property, while there uitextview working in both cases. really weird error, can't figure out why giving exc_bad_access error , problem in ios7 not in ios6. p.s want utf-8 languages display not urdu check property of txtdetaillandscape if "week" may happen due release object arc. make property "strong" , works fine.

Open a shell script from other script and close the first -

i want know how call script script ( know ) also, close first script process remains in background. i use this: #!/bin/bash #script echo "first script" ./ second.sh when this, first script remains in background, and, when close second script exit command, returns first script. use exec : exec second.sh this replaces original shell (script) new one. the notation ./ won't work; can't execute current directory. if thinking of . second.sh , reads new script current script. if thinking of ./second.sh , need write exec ./second.sh . strictly, first script not in background; waiting executed program (which happens second shell script) finish. 'in background' has specific connotations of 'running', whereas first script not actively running when run second.sh .

PHP not removing spaces and showing wrong character length -

i have array of words retrieved database. looks (var_dump): $description_array = array(69) { [0]=> string(3) "out" [1]=> string(2) "of" ............. [44]=> string(5) " as" .................) the 44th element " as" has bit of white space before word. i tried removing foreach($description_array $value) { $value = str_replace(" ", "", $value); } but results of have no effect on element. noticed " as" said have 5 characters. thought might new-lines or other special characters tried: foreach($description_array $value) { $value = str_replace("\n", "", $value); } and foreach($description_array $value) { $value = preg_replace('/\s\s+/', '', $value); } but neither of these commands achieved desired result. ideas, maybe i'm missing simple? you can use array_map() , can use trim function in below $array = array_map('trim',$your_...

How to view pub year based on xml:id through XSLT? -

i using code in xml reference citation links in xml: boulos <link href="#bib-0014"/> corresponding reference: <bib xml:id="bib-0014"><citation type="journal" xml:id="cit-0014"><author><familyname>boulos</familyname>, <givennames>l</givennames></author>. **<pubyear year="1974">1974a</pubyear>**. <articletitle>r&#x00e9;vision syst&#x00e9;matique du genre <i>sonchus</i> l. s.l. v. sous&#x2010;genre 2. <i>dendrosonchus</i>. &#x2013; bot</articletitle>. <journaltitle>not</journaltitle>. <vol>127</vol>: <pagefirst>7</pagefirst>&#x2013;<pagelast>37</pagelast>.</citation></bib> figure citation links in xml: fig <link href="#ecog340-fig-0001"/> corresponding figure: <figure xml:id="ecog340-fig-0001"...

java - Amazon sqs throwing exception connection reset -

i using amazonsqsasyncclient connect amazon sqs, see following execution in logs: info [amazonhttpclient:444] unable execute http request: connection reset java.net.socketexception: connection reset @ java.net.socketinputstream.read(socketinputstream.java:168) @ com.sun.net.ssl.internal.ssl.inputrecord.readfully(inputrecord.java:293) @ com.sun.net.ssl.internal.ssl.inputrecord.read(inputrecord.java:331) @ com.sun.net.ssl.internal.ssl.sslsocketimpl.readrecord(sslsocketimpl.java:798) @ com.sun.net.ssl.internal.ssl.sslsocketimpl.readdatarecord(sslsocketimpl.java:755) @ com.sun.net.ssl.internal.ssl.appinputstream.read(appinputstream.java:75) @ org.apache.http.impl.io.abstractsessioninputbuffer.fillbuffer(abstractsessioninputbuffer.java:166) @ org.apache.http.impl.io.socketinputbuffer.fillbuffer(socketinputbuffer.java:90) @ org.apache.http.impl.io.abstractsessioninputbuffer.readline(abstractsessioninputbuffer.java:281) @ org.apache.http.impl.co...

ios - Unable to determine simulator device to boot. - Xcode -

i downloaded xcode 6 & played bit. after switching previous version of xcode , running in simulator, keep getting error. unable determine simulator device boot. how resolve this? thanks in advance. make sure have 1 ios simulator instance running in dock.

Android: starting activity with extra bitmap error -

i have created app, allows me upload picture on web. resize via php, , i'm trying load these pictures app... i have code download image: public bitmap getbitmapfromurl(string src) { try { java.net.url url = new java.net.url(src); httpurlconnection connection = (httpurlconnection) url.openconnection(); connection.setdoinput(true); connection.connect(); inputstream input = connection.getinputstream(); bitmap mybitmap = bitmapfactory.decodestream(input); return mybitmap; } catch (exception e) { e.printstacktrace(); return null; } } then have asynctask, download images: (i'm trying organize picture 2 in row) public class loadphotos extends asynctask<string,object,void>{ progressbar pb; imageview img; ta...