Posts

Showing posts from September, 2012

javascript - Angular filtering based on the field value -

i have table performing ng-repeat , getting data server <tr ng-repeat="assetsdetail in detailassets | filter: {ind_record_type : !running}:true"> <td>{{assetsdetail.master_asset_type}}</td> <td>{{assetsdetail.minor_asset_type}}</td> <td>{{assetsdetail.detail_asset_type}}</td> <td>{{assetsdetail.product_desc}}</td> <td>{{assetsdetail.vendor_name}}</td> <td>{{assetsdetail.ind_record_type}}</td> </tr> what want achieve here want data except 1 has ind_record_type of running. have far failed achieve this, simple way in view? well, don't need filter that. simple ng-show can trick follows: <tr ng-repeat="assetsdetail in detailassets" ng-hide="assetsdetail.ind_record_type == 'running'"> <td>{{assetsdetail.master_asset_type}}</td> <td>{{assetsdetail.minor_asset_type

mysql - Big users table or split in 2 -

Image
i have following users table: half ion_auth codeigniter , half custom fields. should split table in 2? , store user details in main table , in second user activity count of likes, number of questions , answers , backgrounds?

java - How do I implement online/offline feature with REST based application? -

i building chat feature(web application) in user has list of friends can chat with. friends can online or offline, in facebook. since, application built on rest apis, don't save session , of authentication stateless. so question is, how know online or offline among list? best way implement this? usually chat applications send message client server after set time period, if message not received, user offline. i not java developer, suggest websockets chat. hope helps.

php - readfile('filename.exe') and decode base64? -

i'm using php in order stream file download. part of uses readfile : <?php // headers etc... // ... readfile('file.exe'); ?> this binary file, various reasons (that not relevant question) need store file base64 or similar . how stream file readfile stored encoded base64? i guess there many ways lead success here, i'm looking best & convenient. using stream filters should help: $infile = 'file.exe'; $outfile = 'php://output'; $inhandle = fopen($infile, 'r'); $outhandle = fopen($outfile, 'w'); stream_filter_append($inhandle, 'convert.base64-decode'); stream_copy_to_stream($inhandle , $outhandle); fclose($inhandle ); fclose($outhandle);

Data collection with php using mysqli_escape_string() function -

this question has answer here: php parse/syntax errors; , how solve them? 12 answers i trying collect data user still getting error. syntax error, unexpected 'name' (t_string). here line of code producing error; $name = mysqli_escape_string("$_post['name']"); $name = mysqli_escape_string("$_post['name']"); there 2 issues here. first, function requires db connection passed first parameter, , other being quotes. here proper syntax, , assuming indeed using mysqli_ connect with. $name = mysqli_escape_string($connection, $_post['name']); if not, use mysql_ equivalent $name = mysql_escape_string($_post['name']); or $name = mysql_escape_string($_post['name'], $connection); mysqli_escape_string alias of mysqli_real_escape_string may need change that, or mysql_real_escape_

scala - Does Spark's TwitterUtils library captures all the twitters? -

i using spark's twitterutils library work twitters. however, i'm getting on average 60 twitters per second, while there must far more twitters per second. so, seems twitterutils library not capturing twitters. there solution this? this not linked spark's library, twitter limitation stream. if use public twitter stream, limited 1% of global traffic, around 60 tweets/seconds. if want unlimited access need subscribe paid services, gnip ( http://www.gnip.com ) twitter subsidiary.

c# - Caliburn.Micro assign resolved ViewModel instance to child from parent -

controls:tabcontrolview reusable component. need able create viewmodel/retrieve instance each component usage. <usercontrol x:class="app.views.shell.shellview" ...> <stackpanel orientation="vertical"> <controls:tabcontrolview cal:bind.model="{binding tabcontrolviewmodel}"/> </stackpanel> </usercontrol> in shellviewmodel constructor: public tabcontrolviewmodel tabcontrolviewmodel { get; set; } public shellviewmodel(){ tabcontrolviewmodel = new tabcontrolviewmodel();//for simplicity. resolved ioc } when put break point tabcontrolviewmodel's constructor can see being called 2 times. when setup ioc resolve tabcontrolviewmodel singleton works (as internal call resolving tabcontrolviewmodel served same instance). how should edit code doesn't call bootstrapperbase.getinstance() automatically or how can replace view's viewmodel? i found out viewmodel resolved caliburn automat

unity3d - Detect mouse clicked on GUI -

i got problem in project. want know mouse cliked happend on gui or on game object. have tried showing null reference exception eventsystem eventsystem = eventsystem.current; if (eventsystem.ispointerovergameobject()) debug.log("left click on gui element"); how detect?? there event available or else? ispointerovergameobject() broken on mobile , corner cases. rolled our own our project , works champ on platforms we've thrown at. private bool ispointeroveruiobject() { pointereventdata eventdatacurrentposition = new pointereventdata(eventsystem.current); eventdatacurrentposition.position = new vector2(input.mouseposition.x, input.mouseposition.y); list<raycastresult> results = new list<raycastresult>(); eventsystem.current.raycastall(eventdatacurrentposition, results); return results.count > 0; } source: http://forum.unity3d.com/threads/ispointerovereventsystemobject-always-returns-false-on-mobile.2653

Is the manifest.json for components only? -

while reading documentation sapui5, stumbled upon part application descriptor ( see ). says the application descriptor provides central, machine-readable , easy-to-access location storing metadata associated application or application component. although says "application" or "... component", can not figure out how used application , if necessary set manifest.json if not implementing component. is there clarification if , how manifest.json used within sapui5 applications? purpose maybe data/implementation generation within sap web ide or future plans? i'd appreciate answer on clarifying things, scn, sdn , openui5 pages don't give me clue it. thanks in advance. the data in manifest.json can accessed within sapui5 app , (of course) used component. can access in application in case have component based app. check step 20 of walkthrough tutorial @ https://openui5beta.hana.ondemand.com/#docs/guide/bf71375454654b44af01379a3c3a6273.html

php - is this too much load for an ajax scalable app? -

i have lobby supposed refresh data of signed players. having ajax call repeats every 3 seconds keep lobby-div "live" possible. ajax call fetches json players information. 25 signed people, parsed json this: { "0": [ "dummy player.6935", "dummy player.3476", "dummy player.8299", "dummy player.9591", "dummy player.7282", "dummy player.4067", "dummy player.4818", "dummy player.1396", "dummy player.4198", "dummy player.4244", "dummy player.5060", "dummy player.3496", "dummy player.5932", "dummy player.2524", "dummy player.6162", "dummy player.1828", "dummy player.7738", "dummy player.9144", "dummy player.4312", "dummy player.9270", "dummy player.5935", "dummy player.

Why Date() has different type from new Date() in JavaScript? -

when run in console typeof new date() i object . if evaluate typeof date() i string . why? from the mdn : note: javascript date objects can instantiated calling javascript date constructor: calling regular function (i.e. without new operator) return string rather date object; unlike other javascript object types, javascript date objects have no literal syntax.

arrays - Why do I get a PHP error 406 when trying to use file_get_contents() function and how to solve it? -

i want json array api. why cant using file_get_contents($g_7_14) ? this error get: ( ! ) warning: file_get_contents( https://example.com:443/api/xxx/yyy?app_ids=666&start_date=2015-07-14&end_date=2015-07-14&auth_token=8scr ): failed open stream: http request failed! http/1.1 406 not acceptable in c:\wamp\www\phpexcel\index.php on line 8 and code: <?php //494792609 if ( !empty ( $_get['app_id'] ) ) { $g_7_14 = 'https://example.com:443/api/xxx/yyy?app_ids=666&start_date=2015-07-14&end_date=2015-07-14&auth_token=8scr'; echo $g_7_14.'<br>'; $json_g_7_14 = file_get_contents($g_7_14); /* $ch = curl_init(); curl_setopt($ch, curlopt_url,$g_7_14); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch,curlopt_httpheader,array('accept-encoding: gzip')); $xml_response = curl_exec($ch); var_dump($xml_response);

javascript - How to reliably send tracking event on link click? -

i have tracking event (in form of http call tracking server) fires on clicking of link, fired onclick event. however, appears often, event not registered tracking server because browser cuts off (long-running) event call when loads new page. i'm reluctant wait reply before forwarding user new page, in case reply delayed , user has wait. is there way ensure event call completes , forward user on immediately? maybe preventdefault helps you. don't share code, it's because explain way: $('a.link').on('click', function(e) { e.preventdefault(); var trackinglink = $(this).attr('href'); // ajax stuff $.ajax().success(function() { window.location.href = trackinglink; }); }); with preventdefault() avoid links load page, make ajax requests , if it's successful redirects page of link

c# - WPF Toolkit hide "Key" value in Area Chart -

Image
i have chart displays cpu usage . uses following code add values , refresh: cpuchartvaluelist.add(new keyvaluepair<string, int>(i.tostring(), icputotal_usage)); cpu_chart.datacontext = cpuchartvaluelist; cpu_chart.refresh(); in string value there recorded seconds , int value contais cpu usage . chart rendered correctly can't rid of key string value showing in chart. im sitting 2 hours on , still can't find solution. everything works can't hide "seconds". if add new x-axis , set hidden wpftoolkit adds new axis these seconds on top (what going on?) i've run out of ideas. grateful if provide me way disable this. waiting best regards

Refresh Excel dataset in SharePoint Online with PowerShell 403 error -

i have been attempting implement powershell script access excel workbook, check out, refresh dataset in workbook , check in again. i've combined task in windows task scheduler run script daily server user account has access sharepoint online site. my issue script not run. when view windows event logs can see getting 403 error the script taken document found here document: link download document the task gets following script , location of excel workbook arguments in action config of task (detailed in document above) try { # creating excel com object $xl = new-object -comobject excel.application; # setting excel run without ui , without alerts $xl.displayalerts = $false; $xl.visible = $false; } catch { write-eventlog -eventid "5001" -logname "application" -message "failed start excel" -source "application" exit } foreach ($i in $args) { write-host "handling $i" try { # allow update if can perform check out

asp.net - Javascript Confirmation for CheckBox on Unchecked Click -

i have checkbox auto post when changed. the auto post works fine both (checked , unchecked), want popup dialog box confirm before each event takes place. so far popup box works when checkbox checked. but not popup confirmation dialog box, when checkbox unchecked. question: how popup dialog box uncheck event using client side code (only) <asp:checkbox id="currentcheckbox" runat="server" autopostback="true" checked='<%# bind("bdvalue") %>' oncheckedchanged="sharedfunctionforthischeckbox_checkedchanged" onclick="checkboxconfirmclick(this);" /> <script type="text/javascript"> function checkboxconfirmclick(elementref) { if (elementref.checked) { if (window.confirm('are sure?') == false) elementref.checked = false; } } </script> if current method works can simplify to function checkboxconfirmclick

python - Render Image on a template from a json string [Wagtail CMS] -

i have below output: {'type': 'lead-image', 'value': {'id': 123, 'alt': 'a fish', 'format': 'full-width'}} i want display specific image on html template, how go it? the expand_db_attributes method on wagtail.wagtailimages.rich_text.imageembedhandler translation you're looking for. packaged template tag (please adjust appropriate own use-case - looks you've got python dict there, rather json string): import json django.utils.html import escape wagtail.wagtailimages.rich_text import imageembedhandler register = template.library() @register.simple_tag def json_to_image(json_string): data = json.loads(json_string) # expand_db_attributes expects receive html-escaped attributes, # explicitly escape alt attribute here (assuming it's not # escaped in json) data['value']['alt'] = escape(data['value']['alt']) return imageembedhandler.expan

javascript - How to read URL from a restangular resource? -

i have restangular resource: $scope.user.one('messages', 123).one('from', 123).getlist('unread').then(function(unread){ $scope.unread = unread; }); // get: /users/123/messages/123/from/123/unread i want retrieve resturl $scope.unread , like $scope.unread.getresturl(); //returns /users/123/messages/123/from/123/unread i have tried inspect restangular object every extent possible. knows how resturl? my bad. right there. somehow invisible me. obj.getrestangularurl();

Ruby on Rails Calculations -

i'm new rails , coding in general, , i'm trying teach myself working on app delivery driver. have table called loads, , included columns gross weight, tare weight , net weight. way currently, driver have type in 3 weights manually. i'm trying figure out best way have app calculate net weight (by subtracting tare weight gross weight)and add net column. cut down on driver making simple math mistake. i'm using mysql, can point me in right direction? i add before_validation callback model , let calculate missing value. this: # in model before_validation :calculate_net_weight private def calculate_net_weight self.net_weight = gross_weight - tare_weight end btw. argue makes sense store 3 values in database if calculate 1 other two. having 3 values in databse might fix problems or might make calculation or statistics easier.

android - How to implement Bluetooth Connectivity Actively into multiple Activities using Application Class or Service Class -

i new bluetooth connection process flow. working mini thermal printer device android application. device has own sdk. when activity finishes or gets destroyed connection device being lost. how modify following code prevent happening. printdemo activity package com.zj.printdemo; import com.zj.printdemo.r; import android.content.intent; import com.zj.btsdk.bluetoothservice; import com.zj.btsdk.printpic; import android.annotation.suppresslint; import android.app.activity; import android.bluetooth.bluetoothadapter; import android.bluetooth.bluetoothdevice; import android.os.bundle; import android.os.handler; import android.os.message; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.toast; import android.util.log; public class printdemo extends activity { button btnsearch; button btnsenddraw; button btnsend; button btnclose; edittext edtcontext; edittext edtprint; private static final int r

python - Concatenate columns and use the column names as a binary feature in a new column -

i have dataframe 2 columns contain same type of data: id foo bar 1 f1 b1 2 f2 b2 3 f3 b3 i know how concatenate 2 columns, foo , bar appear in additional column binary feature indicating column came from, so: id foobar column 1 f1 foo 2 f2 foo 3 f3 foo 4 b1 bar 5 b2 bar 6 b3 bar how can achieve that? you do: df = dataframe({'foo': ['f1', 'f2', 'f3'], 'bar': ['b1', 'b2', 'b3']}) print df bar foo 0 b1 f1 1 b2 f2 2 b3 f3 cols = ''.join(list(df)) df = concat([df.foo, df.bar], keys=df.columns).reset_index(0) df.columns = ['source', cols] print df source barfoo 0 bar f1 1 bar f2 2 bar f3 0 foo b1 1 foo b2 2 foo b3

c# - WPF DataGrid: IsVirtualizingWhenGrouping="True" not working -

i have datagrid has collectionviewsource bound it's itemsource property: <datagrid grid.row="0" rowbackground="#10808080" alternatingrowbackground="transparent" horizontalalignment="stretch" verticalalignment="stretch" itemssource="{binding source={staticresource bookingsviewsource}}" rowheight="27" virtualizingpanel.isvirtualizingwhengrouping="true" virtualizingpanel.iscontainervirtualizable="true" virtualizingpanel.scrollunit="item" autogeneratecolumns="false"> <datagrid.columns> <datagridtextcolumn binding="{binding date, stringformat=dd.mm.yyyy}" header="date"/> <datagridtextcolumn binding="{binding path=customers.name}" header="customer"/> <datagridtextcolumn binding="{binding path=customers.str

Laravel 5.1 : Queue event in background not working -

i have created test event under \app\events\testeventtriggered.php : <?php namespace app\events; use app\events\event; use illuminate\queue\serializesmodels; use illuminate\contracts\broadcasting\shouldbroadcast; class testeventtriggered extends event { use serializesmodels; /** * create new event instance. * * @return void */ public function __construct() { } /** * channels event should broadcast on. * * @return array */ public function broadcaston() { return []; } } and event listener under app\listeners\listentomyevent.php : <?php namespace app\listeners\events; use app\events\testeventtriggered; use illuminate\queue\interactswithqueue; use illuminate\contracts\queue\shouldbequeued; class listentomyevent implements shouldbequeued { use interactswithqueue; /** * create event handler. * * @return void */ public function __construct() {

Value of Numeric control in script, LabView -

Image
i trying control keithley 2612a sourcemeter using labview. have installed appropriate drivers , managed connect instrument using visa. experimenting scripting language, instrument uses. is possible use numeric controller - knob example - , use value in script loaded instrument? don't have enough reputation points add images. edit on = 1 off = 0 function hello() display.clear() display.setcursor (1,7) display.settext ("done :)") end smub.reset() smub.source.output = on --set measurement integration time smub.measure.nplc = 1 smub.measure.delay = 0.05 --configure reading buffers smub.nvbuffer1.clear() smub.nvbuffer1.appendmode = 1 smub.nvbuffer1.collecttimestamps = 1 smub.nvbuffer1.collectsourcevalues = 0 smub.nvbuffer1.fillmode = smub.fill_once = 0, 0.5, 0.01 smub.source.levelv = reading = smub.measure.i (smub.nvbuffer1) end delay(5) hello() smub.source.output = off delay(1) display.clear() display.setcursor(1,1) display.settext(str

sql - Add Field to Query -

how add "name" field query select address, count(*) countof dbo.mydb address not null group address having count(*) > 1 ive tried select name, address ... but come error thanks, if want add name column, have add group by or include in aggregate function : select address, name, count(*) countof dbo.mydb address not null group address, name having count(*)>1

How to create bootstrap table with custom column width -

i trying create table using bootstrap. code given below: .aspx page <asp:gridview id="grduserslist" runat="server" cssclass="table table-hover" allowpaging="true" pagesize="20" headerstyle-cssclass="info"></asp:gridview> now, through jquery binding grid, shown below: function populateuserslist(response) { console.log(response); //alert(response[0].firstname); //$('#respval').html(response[0].firstname); $('#childcontent_grduserslist').empty(); if (response.length > 0) { $('#childcontent_grduserslist').append('<tr><th class="col-lg-4 info">name</th>\ <th class="col-lg-3 info">login id</th>\ <th class="col-lg-3 info">email id</th>\ <th class="col-lg-3 info">phone no.</th>\

hadoop - Check whether a variable exists or not in EL Expression inside Oozie Hive action -

i trying create common template oozie workflow used running different hive scripts. each hive script has own parameters. on hive action in oozie, while setting parameters using param tag, need check if variable exists or not , if not exist, need default " ". i tried, < param>my_parameter_var=${empty my_parameter?" ":my_parameter}< / param > this works check if my_parameter null or empty string. check fails if variable doesn't exist @ all; below error: error code : el_error error message : variable [my_parameter] cannot resolved can please assist me on how achieve this? i not sure if still needed in case, there way combination of firstnotnull , wf:conf el functions below. remove white spaces in param element start , end. < param>my_parameter_var=${firstnotnull(wf:conf('my_parameter'),' ')}< /param > wf:conf shall return my_parameter's value if not empty/null/undefined or

python - Batching and queueing in a real-time webserver -

Image
i need webserver routes incoming requests back-end workers batching them every 0.5 second or when has 50 http requests whichever happens earlier. way implement in python/tornado or other language? what thinking publish incoming requests rabbitmq queue , somehow batch them before sending back-end servers. can't figure out how pick multiple requests rabbitmq queue. point me right direction or suggest alternate apporach? i suggest using simple python micro web framework such bottle. send requests background process via queue (thus allowing connection end). the background process have continuous loop check conditions (time , number), , job once condition met. edit: here example webserver batches items before sending them queuing system want use (rabbitmq seemed overcomplicated me python. have used celery , other simpler queuing systems before). way backend grabs single 'item' queue, contain required 50 requests. import bottle import threading import que

jquery - For some reason my background is not high resolutions until the end? -

Image
i have page: link at bottom 2 divs( bottom stanga , bottom dreapta )` look @ picture below understand happens in high resolution. code html: <div class="continut"> <div style="height:60%;" class="carousel">[image-carousel category="test"]</div> <div class="banner-mobile">the top div</div> <div class="bottom stanga">bottom left</div> <div class="bottom dreapta">bottom right</div> </div> code css: .bottom { float: left; width: 50%; height:40%; } .stanga { background:url("http://bagel.dg-site.com/bagel/wp-content/uploads/2015/07/news1-300x246.png") no-repeat center center #b03d3d; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } .dreapta { background:url("http://bagel.dg-site.com/bagel/wp-content/uploads/2015/07/news2-300x246.png") no

C++ string and overloaded operators -

i'm studying c++ library type string. looking operation type can perform, among concatenation. know in c++ operators can overloaded suit class types needs,and know character string literals const char arrays under hood. so, know string type defines constructor takes string literal argument , converts string, can initialize string using: string s="hello!" what happens here impicit conversion (through constructor takes const char*) string , copy initialization performed (through copy-constructor of string). so far good.. (correct me if getting wrong far) now, know can concatenate 2 strings, or can concatenate string , char literal (or vice versa) , string , string literal (so suppose first happens because there's overloaded + operator takes symmetrically char , string, latter happens overloaded + opeartor concatenates 2 strings , implicit conversion const char* string). questions are: 1: why can't concatenate 2 string literals? shouldn't operator+

matlab - Hold the max value of a signal in Simulink for specified amount of time -

Image
i have swinging pendulum in simulink , want valve stay open specific amount of time (say 2 sec or so) @ moment of maximum excitation. finding point of maximum excitation no problem, used if else block on derivative of angle (angular velocity) , if abs(angular velocity)<0.1 (or so) moment of maximum excitation reached. problem holding value high specific amount of time. in image specified signal have , required signal (paint, not exact): i have tried delay , delays bit. zero-order-hold didn't work either, missed signals , output became 0 (unknown phase , period of input signal, else might work) tried this , didn't work didn't have input signal of hold, have input signal shown in figure... what block/subsystem should use create kind of signal?

java - Toggle JDialog visibility on button press or lose focus -

java gurus, looking toggle jdialog's visibility when jbutton pressed or when jdialog loses focus i.e. when area of screen outside jdialog becomes active. lose focus working fine, it's handed windowfocuslistener can't functionality jbutton i.e. 1st click => jdialog visible, 2nd click => jdialog invisible, 3rd click => jdialog visible. i don't want go down route of making jdialog modal or counting clicks on button. any ideas of achieving above functionality in simple, clean way? import java.awt.color; import java.awt.dimension; import java.awt.flowlayout; import java.awt.point; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.awt.event.windowevent; import java.awt.event.windowfocuslistener; import javax.swing.*; public class testframeexample { public static void main(string s[]) { final jdialog dialog = new jdialog(); final jbutton button = new jbutton(); jframe frame = new jframe(&

oracle - PL/SQL and SQL script in one sqlFile with liquibase? -

i try lot options run in room changeset/sqlfile contains pl/sql block , simlple sql statement. e.g.: begin aud.someprocedure('parameter'); end; / insert test_table(_id, value) values(1, 'test'); but following exception: liquibase.exception.migrationfailedexception: migration failed change set [xml path]: reason: liquibase.exception.databaseexception: ora-06550: 4 line, 1 col: pls-00103: encountered symbol: "/" [failed sql: begin aud.someprocedure('parameter'); end; // insert test_table(_id, value) values(1, 'test') ] @ liquibase.changelog.changeset.execute(changeset.java:584) @ liquibase.changelog.visitor.updatevisitor.visit(updatevisitor.java:51) @ liquibase.changelog.changelogiterator.run(changelogiterator.java:73) @ liquibase.liquibase.update(liquibase.java:210) @ liquibase.liquibase.update(liquibase.java:190) @ liquibase.liquibase.update(liquibase.java:186) @ org.jenkinsci.plugins.liqu

grails 2.5 database migration plugin stuck with liquibase 2.0.5 - is it possible to hack a newer liquibase version? -

unfortunately, db migration plugin stuck version 2.0.5 of liquibase, has many bugs, of show stoppers us. however, liquibase 3.3. solves of them. we not have expertise needed edit or modify migration plugin written burt. we need use plugin need able auto-run liquibase update on deployment of war, atremote customer sites have no access (we supply war, deploy it). one solution might "hack" 3.3. liquibase jar in. see in home.grails\ivy-cache\org.liquibase\liquibase-core liquibase-core-2.0.5.jar if overrite 3.3. jar, ivy realise wrong file, , download again? if not option, perhaps explode produced war, swap out war, , repack? of course, if api liquibase supplies has changed, fail. any better suggestions not involving rocket science? our last resort abandon using grails database migration plugin, , hand using liquibase command line, tedious. its unlikely able change grails 3, unfortunately.

unit testing - Android java.lang.NoClassDefFoundError: R$string -

whenever run unit test, error when tries retrieve string value custom config.xml file. background: the project library apk project uses , references library apk project. the error occurs when project tries initiate new object subclass of super class contained on referenced library apk project. the issue explained more below the specific line of code fails error static variable defined below: protected static final string android_config_id = libraryapplication.getapplication().getstring(r.string.api_checkout_config_id_override); it fails following error: java.lang.noclassdeffounderror: com/jon/commonlib/r$string commonlib referenced library apk if wondering. here unit test @runwith(robolectrictestrunner.class) @config(constants = buildconfig.class, manifest=config.none) public class testsearchshows { @test public void testsearchjsonfile(){ eventstesthelper testhelper = new eventstesthelper(runtimeenvironment.application); try {

php - Access files in zip before extracting them -

how can validate files in zip file using finfo_open(fileinfo_mime_type) before extracting them using extractto ? i using ziparchive class: http://php.net/manual/en/class.ziparchive.php $zip = new ziparchive(); if ($zip->open($_files['upload_file']['tmp_name']) === true) { ($i = 0; $i < $zip->numfiles; $i++) { $name=$zip->getnameindex($i); $pieces=explode(ds,$name); if(substr($name, -1)==ds) { //validate directory structure if desired } else { //validate file $mime=$finfo->buffer($zip->getfromindex($i)); } } }

windows services - impossible to start sphinx search : error 1067 -

i'm working in windows, want start sphinx search service. tried firts start command line in list of services panel have error windows not start sphinxsearch service on local computer error: 1067 process terminated unexpectedly. i've searched , tried solution in post ve found , nothing work this config files c:\sphinx\bin\sphinx.conf searchd { listen= 127.0.0.1:9306:mysql41 log = c:\sphinx\log\searchd.log query_log = c:\sphinx\log\query.log pid_file = c:\sphinx\log\searchd.pid } index news { source = news path =c:\sphinx\data\news } indexer { mem_limit = 32m } source news { type = mysql sql_host = localhost sql_user = root sql_pass = sql_db = newssdz sql_query_pre = set names utf8 sql_query = select id\ , categorie\

css3 - How do I apply vendor prefixes to inline styles in reactjs? -

css properties in react not automatically added vendor prefixes. for example, with: <div style={{ transform: 'rotate(90deg)' }}>hello world</div> in safari, rotation wouldn't applied. how accomplished? react not apply vendor prefixes automatically. in order add vendor prefixes, name vendor prefix per following pattern, , add separate prop: -vendor-specific-prop: 'value' becomes: vendorspecificprop: 'value' so, in example in question, needs become: <div style={{ transform: 'rotate(90deg)', webkittransform: 'rotate(90deg)' }}>hello world</div> value prefixes can't done in way. example css: background: black; background: -webkit-linear-gradient(90deg, black, #111); background: linear-gradient(90deg, black, #111); because objects can't have duplicate keys, can done knowing of these browser supports. an alternative use radium styling toolchain. 1 of features auto

dictionary - Use levenshtein distance for keys in defaultdict in python -

i doing sequencing analysis, , i'm trying create default dictionary of genetic sequence based on identifiers. looking @ following example, have created dict, , put both sequences agagag , atatat in same list because have same identifier of cccccc : input: ccccccagagag ccccccatatat code: from collections import defaultdict d = defaultdict(list) d['cccccc'].append('agagag') d['cccccc'].append('atatat') the problem have if key sequence within levenshtein distance of 1 want treated same key. if come across sequence looks this: ccccctacacac i want through dict , see there cccccc , see distance('cccccc', 'ccccct') < 2 maybe change ccccca cccccc , append same list above. hopefully there way of doing this. thanks. you can use difflib.sequencematcher returns 1 equal sequences , can use difference compare : in case : >>> import difflib >>> difflib.sequencematcher(none,'cccccc'

javascript - Adding quotation mark in array values -

i have array of strings in object form received file, need add quotation mark around parameter names of objects strings inside array , around values between square brackets convert strings proper objects. ["{durdham hall electric: [e4.kwh]}", "{university hall substation: [e1.kwh]}", "{university hall substation: [e2.kwh]}"] i have no idea how loop through values , add required symbol in required part. maybe change options.push('<option value="' + '{' + data[devices][1] + ': ' + '[' + 'e' + + '.kwh' + ']' + '}' + '" >' + metername + '</option>') to this, little nice parsable json var data = [[0, 'durdham hall electric:']], devices = 0, metername = 'metername', = 3, options = []; options.push('<option value="' + '{ \\"device\\": \\"' + data[devices][1]

javascript - Is there something like AngularJS' filters for Knockout.js? -

angularjs has angular-filters concept built-in, it's easy reduce dataset elements match example user-input. is there similar available knockout.js ? of course implement on own, using plain old javascript, i'm not performance expert own solution horribly slow. yes, steve sanderson has created knockout-projections plugin knockout. this similar angular-filters can apply map or filter source collection produce collection bind ui. this example projects github readme demonstrates usage , explains how map , filter callbacks executed efficiently: mapping more info follow. now, here's simple example: var sourceitems = ko.observablearray([1, 2, 3, 4, 5]); there's plain observable array. let's want keep track of squares of these values: var squares = sourceitems.map(function(x) { return x*x; }); now squares observable array containing [1, 4, 9, 16, 25] . let's modify source data: sourceitems.push(6); // 'squa

osx - Use theano in a macbook pro without NVIDIA card -

i have: macbook pro (retina, 13-inch, mid 2014) os x yosemite intel iris 1536mb i heard can not use gpu theano cpu do, want know if programming same , internaly theano work cpu or in anothe case gpu. or if when programming have 1 way program each one. thanks lot for part theano program runs on cpu run on gpu, no changes code required. there are, however, few things bear in mind. not operations have gpu versions it's possible create computation contains component cannot run on gpu @ all. when run 1 of these computations on gpu silently fall cpu, program run without failing , result correct, computation not running efficiently might , slower because has copy data backwards , forwards between main , gpu memory. how access data can affect gpu performance quite lot has little impact on cpu performance. main memory tends larger gpu memory it's case entire dataset can fit in main memory not in gpu memory. there techniques can used avoid problem need bear in

Linux: cat to named pipe in a python script -

i have java program uses video framegrabber card. program launched through python launcher.py . the easiest way read video stream found, make java read on named pipe, , works perfectly. session like: $ mkfifo videopipe $ cat /dev/video1>videopipe and in second terminal (since cat command blocking): $ python launcher.py i automate process. unfortunately, result same: java application starts (confirmed through print statement in java program), terminal stalls , nothing appears, exception or else. since process works manually, guess doing wrong in python program. simplify things, isolated piping part: from subprocess import call, popen, pipe, check_call bash_switchto_wintv = ['v4l2-ctl', '-d /dev/video1', '-i 2', '--set-standard=4'] bash_create_fifo_pipe = ['mkfifo', 'videopipe'] bash_pipe_video = 'cat /dev/video1>videopipe' def run(): try: print('running bash commands...') call(

merge - R: left_join creating two extra rows -

i'm working own dataset spatial data set. in spatial data set, >nrow(bmorehoods@data) > [1] 278 and data set has 78 rows. after >a<-left_join(bmorehoods@data,mydata) >nrow(a) >[1] 280 then >head(bmorehoods@data) then row names appear 0 1 2 3 ... and head(mydata) row names appear 1 2 3 4 ... so source of problem? or there other ways merge these data can use them?

html - radiogroup tag not working: HTML5 -

summary: have template should contain radiogroup having 4 radio buttons. these values used change layout of specific block using css. example: <radiogroup class="page-layout"> <radio value="portrait-6-5">portrait, width: 6.5 inches.</radio> <radio value="portrait-7-5">portrait, width: 7.5 inches.</radio> <radio value="portrait-9">portrait, width: 9 inches.</radio> <radio value="landscape-10">landscape, width: 10 inches.</radio> </radiogroup> <div class="container report-block portrait-6-5"> //block </div> the layout of ".report-block" change when there change in radio buttons reference: mozilla mdn issue: using mozilla browser. support radiogroup tag. not want use <input type="radio"> . there other option.

html5 - What are the consequences of using contentEditable on a textarea? -

as can see, @ least on chrome, contenteditable attribute seems ignored on textarea . question a: how it's supposed work? question c: using contenteditable on textarea have consequences other proving you're idiot? question d: why there no question b? just kidding, had clown breakfast today. :d textarea { /* not relevant question, demo */ display: block; width: 500px; } <textarea contenteditable="true">contenteditable="true"</textarea> <textarea contenteditable="false">contenteditable="false"</textarea> <textarea contenteditable="true" readonly>contenteditable="true" readonly</textarea> <textarea contenteditable="true" disabled>contenteditable="true" disabled</textarea> contenteditable has no effect , on textarea, the html5 spec mute subject . contenteditable=false allows make element not editable inside