Posts

Showing posts from May, 2014

sql - How to display a user determined by the maximum number rows -

i'm using laravel 4.2 , have following table looks this id|chosen(boolean('0','1'))|subject|user_id 1|1 |cricket|2 2|0 |cricket|3 3|1 |rugby |2 i choose user_id has chosen rows or in other words user has 1s in chosen column. in case user 2 correct result. i believe answer $table = db::table('tablename') ->select(array(db::raw('count(user_id) countuser'))) ->where('chosen', 1) ->orderby('countuser', 'desc') ->groupby('user_id') ->first(); however how display user_id in view? example: {{$table->user_id}} //should give me '2' error message reads: undefined property: stdclass::$user_id you selecting count only. try this $table = db::table('tablename') ->select(db::raw('count(user_id) countuser, user_id')) ->where('c...

YouTube PHP API v3 - Upload Fails when including recordingDetails - Invalid value for Double -

i'm trying add recordingdetails upload call. seems work fine on small test files, larger files i'm getting following error: failed start resumable upload (http 400: global, invalid value double: ) with of debugging code able find out error happens when executing line of code: $status = $media->nextchunk($chunk); if comment out $video->setrecordingdetails($recordingdetails); same file uploads fine. i'm new api, , can't seem find related error online. guidance or suggestions appreciated! my code below: # file info upload $resource=get_resource_data($ref); $alternative=-1; $ext=$resource["file_extension"]; $videopath=get_resource_path($ref,true,"",false,$ext,-1,1,false,"",$alternative); // create snippet title, description, tags , category id // create asset resource , set snippet metadata , type. // example sets video's title, description, keywor...

excel - Overflow in addition -

string = string b + string c where string b , c numbers stored in form of text , string should contain sum of both , not concatenate both, does, used, string a= cint(string b) + cint( string c) it throws overflow error. enjoy weekend. cint converts integer type, throw overflow exception if result greater 32767 use cdbl (or clng ) instead of cint convert string values double dim string,b string, c string a="1234567" b="9876543" c=cdbl(a)+cdbl(b)

c++ - Template function return type deduction in C++03 -

i implement following in c++03: template <typename t1, typename t2> t1 convert(bool condition, t2& value) { return condition ? value : conversionfunction(value); } except call convert without having explicitly specify t1 . how do that? perhaps use hack. hack defer conversion until use return value. return value helper object allows converted else. template <typename t> struct converthack { t &value_; const bool cond_; converthack (bool cond, t &value) : value_(value), cond_(cond) {} template <typename u> operator u () const { return cond_ ? value_ : conversionfunction(value_); } }; template <typename t> converthack<t> convert(bool condition, t& value) { return converthack<t>(condition, value); }

Python: Exponent-Characters shown in string -

i'm looking way, generate string, contains example "x³". if don't know exponent (3), , want add string, this: "x^"+"3" doesn't work (of course). there way, add numbers, or possibly characters exponent string python? you might want @ sympy : import sympy sympy import init_printing init_printing() sympy.pprint(sympy.exp("x^3")) ⎛ 3⎞ ⎝x ⎠ ℯ sympy.pprint(sympy.exp("x3")) x₃ ℯ

gradle - Multiple dex files define android/support/annotation/AnimRes -

when i`m tring run app, receive following error: app:compiledebugndk up-to-date :app:compiledebugsources :app:predexdebug :app:dexdebug unexpected top-level exception: com.android.dex.dexexception: multiple dex files define landroid/support/annotation/animres; @ com.android.dx.merge.dexmerger.readsortabletypes(dexmerger.java:596) @ com.android.dx.merge.dexmerger.getsortedtypes(dexmerger.java:554) @ com.android.dx.merge.dexmerger.mergeclassdefs(dexmerger.java:535) @ com.android.dx.merge.dexmerger.mergedexes(dexmerger.java:171) @ com.android.dx.merge.dexmerger.merge(dexmerger.java:189) @ com.android.dx.command.dexer.main.mergelibrarydexbuffers(main.java:454) @ com.android.dx.command.dexer.main.runmonodex(main.java:303) @ com.android.dx.command.dexer.main.run(main.java:246) @ com.android.dx.command.dexer.main.main(main.java:215) @ com.android.dx.command.main.main(main.java:106) error:execution failed task ':app:dexdebug'. com.andr...

excel - Dynamically Allocate Bookmarks in a Bullet List in Word -

i trying generate bookmark on line below previous bookmark in bullet list such word document starts [bookmark1] and transformed into [bookmark1] [bookmark2] etc. so can adjust formatting of list line line , input text in list. 1d array level() controls type of bullet point have. bookmarks dynamically created based on dynamically allocated 1d array (called clar()) contains text various points on sheet. program not know how many lines of text array contain until runs. code below run output of program is [bookmark1] will turn (after 6 iterations) [boomark6] so had 1 bookmark called bookmark6 rather 6 in list. attempted use range @ end of previous bookmark not set range @ next bullet point or outside current bookmark. tried expand range using wbnewline , set range @ end of not valid. dim count integer dim countm integer count = 1 while clar(count) <> "" countm = count - 1 prevbmarkname = "clar" & countm bmarkname = "cla...

javascript - Disable swipe event when using popup in jquery mobile -

my application has swipeleft , swiperight feature brings navigation menu. code looks this. $(document).on("swipeleft swiperight", function(swipeevent) { //my code here } in page of app using jquery mobile popup display image. problem have swipeleft , swiperight still works inside popup , brings navigation bar in background , dont want this. i have used data-dismissible="false" on popup widget not help. how think should fix problem? you bind function popupcreate event ( http://api.jquerymobile.com/popup/#event-create ) nullifies swipeleft swiperight functionality. 1 way have popupcreate update global variable true, , have .on(swipeleft,swiperight) check value of variable before doing anything. set false on popupafterclose event.

wordpress - Custom data plugin -

i deliver wordpress pages because it's easy setup. when don't, it's because customer need custom data. example car dealer want data type car models, car windows , car doors - different attributes. these should editable in wordpress admin , easy print out foreach loop frontend. i found plugin custom database tables ( https://wordpress.org/plugins/custom-database-tables/ ) need relationships between different tables. if configure 5 different car doors, want them listed select box when edit car example. doesn't seem support that? is there alternatives creating own plugin this? seems such ordinary case non blogs? thanks.

javascript - How to get innerHTML from one specify child ELEMENT -

all: what want is: <div id="container"> <div class="unwanted"></div> <div class="unwanted"></div> <svg><rect></rect></svg> <div class="unwanted"></div> <div> how can innerhtml of #container svg, is: "<svg><rect></rect></svg>" what want outerhtml of svg element not accessible in way. here outerhtml of svg element is idea of how svg content.

Jquery and jquery.ui -

i think posible change code other more , efective. $(btn_proy1).click(function(){ $("#btn_close").fadein(100); $("#proyectosgrid").hide("explode",1000); $("#proy1").fadein(100); }); $(btn_proy2).click(function(){ $("#btn_close").fadein(100); $("#proyectosgrid").hide("explode",1000); $("#proy2").fadein(100); }); $(btn_proy3).click(function(){ $("#btn_close").fadein(100); $("#proyectosgrid").hide("explode",1000); $("#proy3").fadein(100); }); $(btn_proy4).click(function(){ $("#btn_close").fadein(100); $("#proyectosgrid").hide("explode",1000); $("#proy4").fadein(100); }); $(btn_proy5).click(function(){ $("#btn_close").fadein(100); $("#proyectosgrid").hide("explode",1000); $("#proy5").fadein(100); }); $(btn_close).click(function(){ $("#btn_close").fadeout(100); $("#proyect...

javascript - Vue JS - Remove an object from the data array -

i using vuejs display active users in site. when user becomes active, pusher sends json details - { "token": "97lbfns7pfpbzvlo", "first_name": "joe", "last_name": "smith", "avatar": "http://demo.com/avatar.jpg", "phone": "255-255-2555", "available" : true, "agencies": [ { "name": "some company", "slug": "some-company" } ] } when user signs out, token sent along available: false . need remove them vue data array, stuck. here data array in vue js (pretty basic): data: { responders: [] } update here basic idea of i'm trying accomplish, outside of vue methods . need remove item data array, think more of javascript related issue more specific vue. @michaelsnowden made suggestion store users objects instead of array i...

elixir - Setting up custom response for exception in Phoenix Application -

im writing phoenix application ecto , have following snippet in test {:ok, data} = poison.encode(%{email: "nonexisting@user.com", password: "mypass"}) conn() |> put_req_header("content-type", "application/json") |> put_req_header("accept", "application/json") |> post(session_path(@endpoint, :create), data) > json_response(:not_found) == %{} this throws ecto.noresultserror i have defined defimpl plug.exception, for: ecto.noresultserror def status(_exception), do: 404 end but test still throws ecto.noresultserror, pointers? let's consider how works per environment. in :prod , default render error pages, should see page rendered yourapp.errorview status code; in :dev , default show debug pages, because majority of times have error while building code. if want see rendered error page, need set debug_errors: false in config/dev.exs ; in :test , works production but, because calling a...

python - MAC OS X Pebble SDK 3.0 error building: Compilation error InverterLayer -

a few months ago running pebble sdk 3.0 on mac , worked perfectly, ran apps basalt emulator. recently cleaned(wiped) mac because running slow. today going run apps again didn't have pebble sdk installed. i installed using brew command appears on pebble developer website: http://developer.getpebble.com/sdk/download/ brew install pebble/pebble-sdk/pebble-sdk i found directory on here: /usr/local/cellar/pebble-sdk/3.0 i tried run pebble build remembered needed , clone pebbles repository. did , when pebble build starts building fine then, happens: [17/63] start build aplite: [25/63] app_resources.pbpack.manifest: build/resources/aplite/images/menu_icon.pbi build/resources/aplite/images/logo_splash.pbi build/resources/aplite/images/tile_splash.pbi build/resources/aplite/fonts/ubuntumono-regular.ttf.mono_font_14.pfo ../pebble/common/tools/pbpack_meta_data.py -> build/aplite/app_resources.pbpack.manifest [28/63] c: src/simply/simply.c -> build/src/simply/simply.c....

Textureview/Surface view for Camera preview - Android -

i working on developing android applications uses camera. display camera preview, observed lot of examples using surface view or texture view. why these preferred on using imageview display camera preview? have used imageview display preview , works fine. thanks. please not use imageview this. extremely inefficient, , i'd surprised if able produce high-resolution preview (1080p) approach. surfaceview , textureview both directly push zero-copy buffers camera drivers hardware composer or gpu, respectively. there no buffer copies or transformations, except whatever final conversions need done @ destination. reduces memory bandwidth , cpu overhead substantially. creating bitmaps slow, cpu-hungry, , makes several copies of each frame, wasting memory well.

how to configure mongodb to start with additional parameters -

i'm running mongodb on ubuntu 14. able automatically start mongod --rest flag where specify that? in /etc/init/mongo.conf - add --rest list of daemon_opts

type systems - Haskell converting [Char] to Char -

i'm working on haskell program uses whte network.wai , network.socket.internal modules. in program, have function, defined so: prepareip :: request -> [([char], [char])] prepareip req = [("remote", head $ spliton ":" $ show $ remotehost req)] originally, made monadic expression (mostly readability , clarity), written: prepareip :: request -> [([char], [char])] prepareip req = ip <- head $ spliton ":" $ show $ remotehost req [("remote", ip)] while former implementation work properly, monadic 1 threw error can't wrap head around: output type not [([char], [char])] , [([char], char)] -- value ip was, reason, being turned single character rather string! i tried prototyping in ghci , type-checking using module references :t in ghci, no avail, , still don't know caused error. can clue me in on why type conflict happening? the reason why you're seeing error because you're trying shove ...

How can I fire a function in viewcontrol from map event in ExtJS? -

i have mvvm app openlayers map. when doing specific event on map (like finishing draw) want fire "add" event of extjs grid. i've tried accessing viewcontroller using myapp.app.getcontroller('itemscontroller') error : unrecognized class name / alias: app.controller.itemscontroller how can call viewcontroller method or fire event of grid item starting adding items grid ? ext.define('app.view.grids.itemsviewcontroller', { extend: 'ext.app.viewcontroller', alias: 'controller.itemscontroller', onnewclick: function (button, evt) { var newitem = ext.create('app.model.items.item', { id:'', name:'' }); this.isnewrecord = true; this.newrecordid = newevent.get('id'); var grid = this.lookupreference('itemsgrid'); grid.getstore().insert(0, newevent); grid.getplugin('itemsrow...

wcf - Silverlight receives remote server returned an error Not Found, and the service continues to run and ends perfectly -

i have silverlight application, when call wcf service takes longer 2 minutes, error "remote server returned error not found", execution continues on server, ends perfectly. know that, because of results in database tables , because email @ end of run. in client: cliente.innerchannel.operationtimeout = new timespan(1, 0, 0); in server <binding name="mybasichttpbinding" closetimeout="02:30:00" opentimeout="02:30:00" receivetimeout="02:30:00" sendtimeout="02:30:00" maxbufferpoolsize="2147483647" maxreceivedmessagesize="2147483647" maxbuffersize="2147483647"> if execution takes less 2 minutes, got return. tested loop expected 2 minutes , return, worked perfectly. increasing loop time 3 minutes same error: "remote server returned error not found". please check url return exception form wcf silverlight: creating , handling faults in silverlight ...

swing - calling stand alone java application from a java servlet -

i new java. have been trying java application development. i have created stand alone java application. basic calculator application basic operations addition, subtraction, multiplication , division. developed using java swings , awt.its gui i have java servlet application takes 2 inputs (numbers) user , returns result. whatever basic calculator does, servlet can such operations on numbers , return result client web browser. (client html file) instead of servlet doing operations, want invoke(from servlet) stand alone application operations , return result servlet. servlet returns result client. possible call stand alone java application servlet. if different ways? to invoke application,you have write bat or sh file based on operating system. -- invoke command using processbuilder -- sample code match requirement if (osname.indexof("nux") >= 0 || osname.indexof("nix") >= 0) { //for sending request sh ...

asp.net mvc - Using CSS variables in MVC view (w/ bootstrap) -

i have different navbar's design according user login. not options available (in menu) css definitions (colors, , on...). possible define them variables maintaining example bootstrap scheme. exchanging colors saw: change navbar color in twitter bootstrap 3 answered skelly it solve problem. need colors (...) decided when view generated. thanks in advance.

Python mock access "real" objects while mocking a module -

is possible access "real" objects while mocking module? i'm trying mock function, throw "real" exceptions, this: @mock.patch('my_project.requests') def test_foo(self, mock_requests): mock_requests.post = mock.mock(side_effect=requests.connectionerror()) thread = commandthread("command", 3, 2, 0) thread.run() #this exercise requests.post self.assert(thread.was_successful false) inside commandthread have check like try: requests.post(url, data=data) except (requests.connectionerror, requests.timeout): self.was_successful = false however, test fails because exception not caught inside try/except block (when except exception: works) reason, think, because mocked "namespace" in test case, raise my_project.requests.connectionerror exception rather proper, requests.connectionerror original package. somehow possible access/throw "real" exceptions? this happening because mock overwr...

javascript - Google maps api kml filling incorrect -

i have simple html , simple kml file ma trying display in google maps. problem filling of single polygon isn't working correctly. if @ example below, can see polygon filled on right side (which correct framing). zoom in 1 level , filling flips other side. zoom in again, , flips back. zooming out once , flips, zoom out twice , correct filling. , remains correct keep zooming out. i have read elsewhere using geoxml3 parse kml rather having google it. trunk download doesn't support polygons though,s (think) downloaded branch version of it. based on that, appears parsing kml , creating google.maps.polyline objects. problem need display hundreds (of not thousands) of polygons , load time convert kml expect performance limiting. not mention, have google's zoom level simplification of kml files. any thoughts? has been working couple of years , broke few weeks ago. tested on chromium 37 (linux) firefox 38 (linux), chrome 43 (win7), firefox 37 (win7), , ie11 (win7...

php - Find array elements that have a certain key-name prefix -

i have associative array lots of elements , want list of elements have key name prefix. example: $arr = array( 'store:key' => 1, 'user' => 'demo', 'store:foo' => 'bar', 'login' => true, ); // need with: // function should return elements key starts "store:" $res = list_values_by_key( $arr, 'store:' ); // desired output: $res = array( 'store:key' => 1, 'store:foo' => 'bar', ); you : $arr = array( 'store:key' => 1, 'user' => 'demo', 'store:foo' => 'bar', 'login' => true, ); $arr2 = array(); foreach ($arr $array => $value) { if (strpos($array, 'store:') === 0) { $arr2[$array] = $value; } } var_dump($arr2); returns : array (size=2) 'store:key' => int 1 'store:foo' => string 'bar' (length=3)

java - How to fix "import com.dyuproject cannot be resolved" error -

i'm new java , new maven , protostuff project ( protostuff website ). need use protostuff serialize/deserialize xml google's protobuf format. tried using protobuf-java-format package, there's documented error in deserialization show-stopper me ( issue 37 ). so far i've done following: downloaded protostuff-1.3.1 & extracted it. ran mvn integration-test , mvn install , mvn package and steps succeeded. i created new maven project , included proto described here i modified pom.xml , ran protostuff:compile on proto described in aforementioned link , generating following person.java file // generated http://code.google.com/p/protostuff/ ... not edit! // generated foo.proto package com.example.foo; import java.io.externalizable; import java.io.ioexception; import java.io.objectinput; import java.io.objectoutput; import com.dyuproject.protostuff.bytestring; import com.dyuproject.protostuff.graphioutil; import com.dyuproject.protostuff.input; import com....

php - form_open doesn't work (Codeigniter - IIS) -

i have form (login), want call method on controller, when clicking button "sign in" method not executed , returns main screen data entered. my view (login.php) <?php echo form_open('home/loginv'); ?> <div class="form-group m-b-20" > <input name="usuario" type="text" class="form-control input-lg" placeholder="name" data-required="true" value="<?php echo set_value('usuario') ?>" ></input> <?php echo form_error('usuario'); ?> </div> <div class="form-group m-b-20"> <input name="password" type="password" class="form-control input-lg" placeholder="password" value="<?php echo set_value('password') ?>" ></input> ...

java - Uploading an image to Parse.com rotates it by default by 90 degrees. Any solutions to this? (Android) -

Image
i have app has functionality can upload images parse.com. problem parse.com, after upload, rotates image 90 degrees. has encountered problem? image taken , uploaded way selected gallery. i have tried decoding image bitmap, rotating it, , converting bytearray, result takes 1.5mb image (for example), , turns 6.9mb one, unreadable well. here how take , upload image parse: @override public void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); //detects request codes if(requestcode == get_from_gallery && resultcode == activity.result_ok && data != null) { selectedimageuri = data.getdata(); selectedimagepath = getpath(selectedimageuri); picasso.with(context) .load(selectedimageuri.tostring()) .resize(500, 500) .centercrop() .noplaceholder() .into(profilepictureimageview, new callba...

google chrome - XAMPP ( Apache ) randomly stops working - "ERR_CONNECTION_TIMED_OUT" -

so here's situation: i have small website minimal server load on seemingly random basis when clicking links chrome gives me "webpage not available" screen. refreshing page fixes issue, i'm not sure why or how happens. sometimes instead of webpage not available load forever until refresh. any appreciated. edit #1 : has been problem me on home network , on phone ( wifi off , mobile data used )

c# - Unable to load 'paypal' section from your config -

i'm experiencing problem paypal sdk .net. i've filled out settings in web.config, when try use paypal sdk's configmanager fetch these settings, comes following error: unable load 'paypal' section *.config: error occurred creating configuration section handler paypal: exception has been thrown target of invocation. i hoping might have experienced issue before, or otherwise knows how me. i've tried loading web.config settings manually using configurationmanager.getsection("paypal") no luck. thanks in advance, hope can me! my web.config: <?xml version="1.0" encoding="utf-8"?> <!-- more information on how configure asp.net application, please visit http://go.microsoft.com/fwlink/?linkid=301880 --> <configuration> <configsections> <section name="paypal" type="paypal.sdkconfighandler, paypal" /> <section name="log4net" type="log4net.config....

notifications - Sinch didReceiveIncomingMessage: called on initialization incorrectly -

if user receives 20 messages in app, deletes app, reinstalls it, notification badge on app icon increments 20 after first open of app. time badge icon incremented in didreceiveincomingmessage: sinch method should called when client receives new incoming message. however, there no new incoming messages after installation , badge icon reads total messages received user, leading me believe after sinch client initialized, messages registered user seem run though sort of process calls didreceiveincomingmessage: method each message. i've tried understand what's going on during initialization of sinch client , research issue nothing seems come up. ideas? its design, when install in on "new" client deliver messages last 30 days device. if dont want badges on can check timestamp , not "consider" new. make sense you?

android - Hosting Chromecast receiver app on home server -

i'm going building first chromecast application, plans build board game displayed on screen using chromecast receiver application. i'm student cash tight, @ moment have 3 websites hosted on lan, using raspberry pi 1 host 2 of websites on apache server , raspberry pi 2 host play-framework application. i want host chromecast receiver app on raspberry pi 2 (removing play application), unsure after reading docs on googles website weather possible. anybody have insight this? if not planing publish app, can that; make sure use ip address of server rather name when register receiver (otherwise chromecast won't able access server); means have make sure ip address of web server doesn't change. other options have are: use google drive host receiver: personal use, enough (we have documentation on how can set up, little bit different sharing doc) use app engine hosting. both of these solutions free development , personal use; advantage of them can use rea...

Maxima use with php -

i try use function shell_exec() or system() execute maxima scripts php. example: <?php chdir("c:\program files (x86)\maxima-sbcl-5.35.1.2\bin"); $cmd = "maxima"; $res = exec($cmd,$out,$status); echo "out="; print_r($out); echo "res=".$res.php_eol; echo "status=".$status.php_eol;` ?> output: out=array ( [0] => maxima 5.35.1.2 http://maxima.sourceforge.net [1] => using lisp sbcl 1.2.7 [2] => distributed under gnu public license. see file copying. [3] => dedicated memory of william schelter. [4] => function bug_report() provides bug reporting information. [5] => (%i1) ) res=(%i1) status=0 in match "(%i1)_" have run script "solve(x^2-1=0, x)"; but it's not recognized cmd script. you’re trying run maxima in interactive mode, i.e. start command shell , interactively enter expressions , results in return. what need non-interactive mode. according...

rest - How to implement android RESTful client with Robospice (or something like this) + OAuth? -

how implement robospice (or this) + oauth? maybe can share link examples of practices creating restful android clients? can't figure architecture of restful app oauth, cover problems activity's lifecycle. of course know virgil dobjanschi "google i/o 2010 - android rest client applications". libraries robospice easy implement. if app uses oauth authorization service? libraries oauth useful? store access token? how execute requests synchronously? etc. ... i looking complete code examples or @ least advices design , architecture. it depends. talking oauth 1 or oauth 2? former, use signpost . latter, use robospice + google http client + google oauth client library . if use google http client network library, need create own httpclientspiceservice based on googlehttpclientspiceservice , can find in robospice. then, need this: public static httprequestfactory createrequestfactory() { httptransport httptransport = androidhttp.newcompatibletransport(...

proxy - actionHero.js Set Http Header -

i want know if there way set http.header in actionhero.js: in our server working actionhero.js , go. need send on "header" 2 domain name "client domain & mine(actionhero service)" go service. or if there other way on proxy server thank in advance assuming mean response header client, in actions or initializers can do: data.connection.rawconnection.responseheaders.push(['x-my-header', 'abc123']) if want set persistent headers server responds requests with, can set in api.config.servers.web.httpheaders

haskell - How do you get and use the dependent type from a type class with functional dependencies? -

how , use dependent type type class functional dependencies? to clarify , give example of latest attempt (minimised actual code writing): class identifiable b | -> b -- if know a, know b idof :: -> b instance identifiable int int idof = f :: identifiable int b => int -> [b] -- ghc infer b functional dependency used in identifiable, , instance? f = [5 :: int] but ghc not infer b, seems, prints error: couldn't match expected type ‘b’ actual type ‘int’ ‘b’ rigid type variable bound type signature f :: identifiable int b => int -> [b] @ src/main.hs:57:6 relevant bindings include f :: int -> [b] (bound @ src/main.hs:58:1) in expression: 5 :: int in expression: [5 :: int] in equation ‘f’: f = [5 :: int] for context, here's less minimised example: data graph graph :: (identifiable b) => graphimpl b -> graph getimpl :: identifiable b => graph -> graphimpl b getimpl (graph impl) = impl the workaround her...

Allegro C++ / how to remove sprite -

i have problem removing sprite in allegro. "game" easy, main object rides on map , eats small balls. after player gains 1 point, ball should disappear. , problem don't know how remove ball. i don't use oop, game. know function delete it?

Wordpress multiple slugs for a Custom Post Type -

a custom post type can registered 1 slug (e.g. products) register_post_type('products', $args); how can add multiple slugs same custom post type? website_address.com/en/products/ website_address.com/fr/produits/ website_address.com/it/prodotti/ the rewrite argument register_post_type() accepts array. 1 of array keys slug . i18n this: register_post_type( 'products', array ( 'rewrite' => array ( 'slug' => _x( 'products', 'url slug', 'your_text_domain' ) ) ) ); idea taken here . ref: https://codex.wordpress.org/function_reference/register_post_type

Git history: Go figure -

how can tell based on git history work been done me , work been done 1 else? there 2 people working on project, me(person a) , team mate(person b). person works on 10 files , person b works on 10 files 1 file in common person a. person b makes commit , push person makes commit person makes pull person solve conflict person commit , push now year latter, don't remember files person , files person b been working at, how can check based on git history? clarification problem when commit after merging conflict, shows you been working on of files part of conflict-commits , not yours. git blame list person last modified each line.

Jquery syntax and regex operators -

can 1 explain || operator mean in following line - mean or. if means or how 1 interpret line because doesn't make sense: d = a.attr("data-template") || "<% remainingchars %> characters left" below code taken $("[maxlength]").each(function (ind, elem) { var b = $(this), = b.parent(".form-group").find(".caption"), d = a.attr("data-template") || "<% remainingchars %> characters left"; and html: <div class="form-group"> <small class="caption" data-template="<% remainingchars %> characters left"> 150 characters left </small> <input type="text"> </div> what second replace part of following regex , {{maxcount}} mean? c = d.replace(/<% remainingchars %>/gi, g()).replace(/{{maxcount}}/gi, j); the code d = a.attr("data-template")...

shell - Linux text match beep -

i want have utility check console output, , in case of text match "error" make beep or other type of event. can me find some? here's do: redirect output file. run diff on file versus "truth data". see here on how use diff in if statement: bash: using result of diff in if statement if diff returns nothing, play sound. details sound playing can found here: https://unix.stackexchange.com/questions/8607/how-can-i-play-a-sound-when-script-execution-is-ready good luck!

ios - WatchKit interface: set button in same horizontal line -

i designing watchkit application , want put 2 buttons in same horizontal line. button size small , have tried ways set in screen. after setting first button on right side, tried set in same horizontal line in left side, can not move second button in same horizontal line. able set 1 button in horizontal line in watchkit storyboard. how can place buttons side-by-side? you have setting button in group , make group "layout" horizontal in file inspector , problem slove for more understanding follow below link how put 1 wkinterfacelabel below wkinterfacelabel?

java - Why do these two apparently identical objects have different class types? -

this question has answer here: what double brace initialization in java? 11 answers i have class user , have 2 fields: id, name package test; public class user { private long id; private string name; public long getid() { return id; } public void setid(long id) { this.id = id; } public string getname() { return name; } public void setname(string name) { this.name = name; } } then in main class, tried initialize user object 2 different approach: package test; /** * @author lhuang */ public class main { public static void main(string[] args) { user u = new user() { { setid(1l); setname("lhuang"); } }; system.out.println(u.getclass()); user u2 = new user(); u2.setid(1l); ...

php - modifying a JSON data -

i want modify json data format using php. i have array this: array ( [0] => stdclass object ( [0] => thu apr 30 12:25:12 +0000 2015 ) [1] => stdclass object ( [0] => wed apr 15 21:57:05 +0000 2015 ) ) i have tried json_encode($data); coming this: [{"0":"thu apr 30 12:25:12 +0000 2015"},{"0":"wed apr 15 21:57:05 +0000 2015"}] but want format: ["thu apr 30 12:25:12 +0000 2015","wed apr 15 21:57:05 +0000 2015"] what should ? try function, pass array argument function to_array_of_strings($data){ $result_array = array(); foreach($data $key => $object){ foreach($object $object_key => $object_value){ $result_array[] = $object_value; } } return $result_array; }

python - Float must be a string or a number? -

i have simple program. code: money = open("money.txt", "r") moneyx = float(money) print(moneyx) the text file, money.txt, contains this: 0.00 the error message receive is: typeerror: float() argument must string or number it simple mistake. advice? using python 3.3.3. money file object , not content of file. content, have read file. if entire file contains 1 number, read() need. moneyx = float(money.read()) otherwise might want use readline() read single line or try csv module more complex files. also, don't forget close() file when done, or use with keyword have closed automatically. with open("money.txt") money: moneyx = float(money.read()) print(moneyx)

d3.js - Transit / Duration Errors in d3js and Meteor -

i've been looking solution no luck. can't rid of error, yet every example d3 in meteor i've seen has it. array getting passed d3: {categoryname:"shooter", count:"19"} {categoryname:"action", count:"23"} error encountered in console: "typeerror: slice.transition not function" "typeerror: slice.duration not function" guide i've been following: http://bl.ocks.org/dbuezas/9306799 code: https://gist.github.com/mayvn10/83d062eb7fd257b07c33 if can shed light on why transition , duration don't work, i'm ears! thanks! move enter this... var slice = svg.select(".slices") .selectall("path") .data(pie(resultarray), function(d) { return d.data.categoryname; }); slice.enter() .append("path") .attr("class", "slice") .attr("d", arc) ...

windows runtime - How to display UIElement but without UI interactions (to touches, clicks, ...) -

i add kind of watermark on page in application : watermark uielement (a canvas instance partial opacity) on top of others controls. and want be "transparent" touches/clicks/gestures . "transparent", mean controls behind should act touches/clicks/gestures. instance if watermark above kind of document viewer, can still use swipe navigate document viewer (across watermark canvas). in different attempts (i tried manipulationmode, pointerpressed, ...) watermark either not visible or either blocking touches/clicks/gestures. unfortunately, there isn't way in windows 8.1 application place xaml content on webview without obstructing mouse/gestures passed. while using ishittestvisible correct choice, due nature of how webview integrated, not work. (this not work in current builds of windows 10.) the other option may not desirable manipulate html content, invokingscriptasync , adding html img element body dynamically.

c# - How regular expression OR operator is evaluated -

Image
in t-sql have generated uniqueidentifier using newid() function. example: 723952a7-96c6-421f-961f-80e66a4f29d2 then, dashes ( - ) removed , looks this: 723952a796c6421f961f80e66a4f29d2 now, need turn string above valid uniqueidentifier using following format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx , setting dashes again. to achieve this, using sql clr implementation of c# regexmatches function ^.{8}|.{12}$|.{4} regular expression gives me this: select * [dbo].[regexmatches] ('723952a796c6421f961f80e66a4f29d2', '^.{8}|.{12}$|.{4}') using above, can build again correct uniqueidentifier wondering how or operator evaluated in regular expression. example, following not work: select * [dbo].[regexmatches] ('723952a796c6421f961f80e66a4f29d2', '^.{8}|.{4}|.{12}$') is sure first regular expression first match start , end of string, other values , returning matches in order (i have issues if example, 96c6 matched after 421f ). ...

c# - UNIDUINO HELP SWITCH CAMERA'S -

i need script go next camera every time press button on arduino, can't working can please me? i got arduino communicating anity can't head around camera switching part. could tell me how make button press hop next camera, need 1 button show camera's using unityengine; using system.collections; using uniduino; #if (unity_3_0 || unity_3_0_0 || unity_3_1 || unity_3_2 || unity_3_3 || unity_3_4 || unity_3_5) public class digitalread : uniduino.examples.digitalread { } // unity 3.x #endif namespace uniduino.examples { public class digitalread2 : monobehaviour { public arduino arduino; public int pin = 2; public int pinvalue; public int testled = 11; public int licht; public int enable; public int val = 0; public gameobject cam1; public gameobject cam2; void start () { arduino = arduino.global; arduino.log = (s) => debug.log("arduino: ...

google apps script - How do I sum input box values and use the sum as a variable? -

in google apps spreadsheet, trying define number of spreadsheet rows want process using input box define start , end rows. need add "1" sum total number of rows want process. math looks like: (endrow - startrow) + 1 = numrows the variables want sum startrow , endrow. need add 1 total desired value numrows. function onopen() { var ui = spreadsheetapp.getui(); ui.createmenu('run script') .additem('create certs', 'menuitem1') .addtoui(); } //nest createdocument function within menuitem1 function function menuitem1() { function createdocument(firstname, lastname, course, date) { } //the createdocument function used here (moved line 9) var sheet = spreadsheetapp.getactivesheet(); //var startrow = browser.inputbox("enter start row"); //var numrows = browser.inputbox("enter number of rows merge"); //var datarange = sheet.getrange(startrow, 1, numrows, 7); //here add rows script...