Posts

Showing posts from April, 2014

parallel processing - bash: running script on multiple directories simultaneously -

let's have multiple directories: nmg_1, nmg_2,..., nmg_5 . each of these directories contains 2 subdirectories: fol, unf . in each of subdirectories there text file. so, have script: run.sh , read line of text files in each subdirectory , output file. thus, wondering, there way run script in parallel, is, script run in multiple subdirectories @ once? given run.sh required processing on 1 text file @ time, following command keep 4 parallel bash sessions alive: find -name "*.txt" -print0 | xargs -n 1 -p 4 -0 -i {} bash run.sh {} from man xargs : --max-procs=max-procs, -p max-procs run max-procs processes @ time; default 1. if max-procs 0, xargs run many processes possible @ time. use -n option -p; otherwise chances 1 exec done.

How to do a for with fades in jquery? -

suppose have div: <div id="blink">blink</div> and want blink 3 times. this ugly code that : var t = animationtime = 600; $("#blink").fadeout(t).fadein(t).fadeout(t).fadein(t).fadeout(t).fadein(t); but if want blink ten times? how can loop fades? thanks in advance. animation on same element gets added queue, add them in loop! @:) for (var = 0; < 10; i++){ $("#blink").fadeout(t).fadein(t); } jsfiddle: http://jsfiddle.net/trueblueaussie/22bpkhtf/2/

Boilerpipe import error in python -

i have installed boilerpipe , jpype in python getting error while importing boilerpipe >>> import boilerpipe traceback (most recent call last): file "<pyshell#0>", line 1, in <module> import boilerpipe file "c:\python27\lib\site-packages\boilerpipe\__init__.py", line 10, in <module> jpype.startjvm(jpype.getdefaultjvmpath(), "-djava.class.path=%s" % os.pathsep.join(jars)) file "c:\python27\lib\site-packages\jpype1-0.6.0-py2.7-win32.egg\jpype\_core.py", line 50, in startjvm _jpype.startup(jvm, tuple(args), true) runtimeerror: unknown exception how can solve issue? thanks in advance

javascript - Unit Test a AngularJS Directive's Controller (Karma, Chai, Mocha) -

having trouble reaching directive's scope unit test. getting generic compile errors when trying run unit test. my app compiles ( gulp ) , runs fine, , can unit test non-directive's fine well. not sure how test's work directive, trying other people's solutions educated guesses. main page's html , js <div company-modal="companyoptions" show-close="false"></div> . (function() { 'use strict'; angular .module('app') .controller('companymodalctrl', ['$scope', selectionpage]); function selectionpage($scope) { $scope.companyoptions = {}; } })(); here first portion of directive (it big including important-top part. (function() { 'use strict'; angular .module('app') .directive('companymodal', companymodal ); function companymodal() { return { restrict: 'a', replace: fal

How to concatenate two class arrays to an allocated space in c++ -

i have 2 class arrays, each 1 pointer pointed to. wonder possible concatenate these 2 arrays new allocated space. in mind std::copy(). possible use copy()? or other idea? just create new array , iteratively copy each old array new array using loops

javascript - Index-Id always has the same value for every input -

so have dynamically created form index-id of inputs names championspell[] need know 1 thought of using index-id changes every inputs index same value when pressing add spell button. can test problem here http://89.69.172.125/test.php $(function() { $('body').on('click', '#addspell',function() { $( '<p><select name="change[]" id="change[]" onchange="val(this)"><option value="passive">passive</option><option value="q" selected>q</option><option value="w">w</option><option value="e">e</option><option value="r">r</option></select><label for="var"><input type="text" id="championspell[]" name="championspell[]" data-id="" readonly="true"><br><textarea type="text"

Change width size using CSS when window size is reduced -

in general, want body div 60% width of window size. there exceptions. on large monitor, gets big, have set max-width of 800px, so: #lbp-text-body {margin-top: 100px; width: 60%; max-width: 800px; text-align: justify} this works pretty good, text adjusts within range, @ max threshold holds shape. now want similar small window sizes. i've added 'min-width: 300px;' , seems seems override width 60%, however, if screen size less 300px, user have scroll horizontally see part of text. i prefer actual width size change 90% or 100% after viewer size hits 300px threshold. any ideas on how this? you can use media query achieve this: js fiddle example @media screen , (max-width: 300px) { #lbp-text-body { // whatever styles want have @ 300px or less } } you can use media-queries have specific styles if window greater specific width using min-width . @media screen , (min-width: 800px) { #lbp-text-body { // whatever styles want have @ 800p

function - What type of programming is this? -

Image
i finished taking entry placement test computer science in college. passed, missed bunch of questions in specific category: variable assignment. want make sure understand before moving on. it started out easy things, "set age equal age" int age = 18, pretty simple but then, had question had no clue how approach. went like... "determine if character c is in alphabet , assign variable" i function, issue is, gave me literally line write entire answer (so 50 characters max). here how answer box looked: my first thought like in_alphabet = function(c) { var alphabet = ["a", "b" ... "z"] if(alphabet.indexof(c) != -1) return true; } but solution has 2 issues: how can set "c" value when whole function equal in_alphabet? i can't fit small answer box. 99% sure looking else. does know looking for? can't think of 1 line solution this language doesn't matter (although solution in java/c+

security - Securely running user's code -

i looking create ai environment users can submit own code ai , let them compete. language anything, easy learn javascript or python preferred. basically see 3 options couple of variants: make own language, e.g. javascript clone basic features variables, loops, conditionals, arrays, etc. lot of work if want implement common language features. 1.1 take existing language , strip core. remove lots of features from, say, python until there nothing left above (variables, conditionals, etc.). still lot of work, if want keep date upstream (though ignore upstream). use language's built-in features lock down. know php can disable functions , searching around, similar solutions seem exist python (with lots , lots of caveats). i'd need have understanding of language's features , not miss anything. 2.1. make preprocessor rejects code dangerous stuff (preferably whitelist based). similar option 1, except have implement parser , not implement features: preprocessor has unde

oracle - Getting common fields of two tables in PL/SQL -

suppose table , table b have various fields. easy way common fields among table , table b ? want inner join on these tables don't know common fields are. note in pl/sql. when table a. or b. list of fields names of each table in drop down menu. common fields. it depends on mean "common fields". if want colums names same in both tables, can use query: select t1.column_name user_tab_columns t1 join user_tab_columns t2 on t1.column_name = t2.column_name /* , t1.data_type = t2.data_type , t1.data_length = t2.data_length */ t1.table_name = 'a' , t2.table_name = 'b' ; demo: http://sqlfiddle.com/#!4/2b662/1 but if @ tables in above demo, see table a has column named x datatype varchar2 , , table b has column named x of different type int . if want columns have the same names, same datatypes , same length , uncomment respective conditions in above query.

VBA Macro to extract data from a chart in Excel 2007, 2010, and 2013 -

Image
i sent excel sheet 4 charts. data charts in workbook not provided. goal: want extract data charts using vba sub. problem: having trouble "type mismatch." when try assign variant array oseries.xvalues range of cells. option explicit option base 1 ' 1. enter following macro code in module sheet. ' 2. select chart want extract underlying data values. ' 3. run getchartvalues sub. data chart placed in new worksheet named "chartname data". ' sub getchartvalues() ' dim lxnumberofrows long dim lynumberofrows long dim oseries series dim lcounter long dim oworksheet worksheet dim ochart chart dim xvalues() variant dim yvalues() variant dim xdestination range dim ydestination range set ochart = activechart ' if chart not active, exit if ochart nothing exit sub end if ' create worksheet storing data set oworksheet = activeworkbook.worksheets.add oworksheet.n

git - get size of commit from github api -

i've been looking through github api trying work out there's simple way size of commit, i.e. what's amount of change took place: https://developer.github.com/v3/repos/commits/ my google , stackoverflow searches turned up: git: show total file size difference between 2 commits? and few other command line options, wonder if knows of way through github api? many in advance

html - PHP Encoding iso -

Image
i working on university website have access body of page, cant change encoding of pages. pages use encoding: <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> i want include file called content.php include('content.php'); when happen the problem can not find text editor convert content.php iso-8859-1 encoding. tried different types encoding content.php iso-8859-6 nothing works. someone please suggest solution encoding problem. in advance. you try using notepad ++

C# forms and textboxes -

how access textbox in form1 when click button form2 ? i want write specific text in textbox in form1 after click button form2 , closes itself. as guessed can solve issue as form1.cs public partial class form1 : form { public form1() { initializecomponent(); } private void button1_click(object sender, eventargs e) { launchform2(); } private void launchform2() { using (var form2 = new form2()) { form2.ontextenteredhandler += form2_ontextenteredhandler; form2.showdialog(); } } private void form2_ontextenteredhandler(string text) { //this event fire when click on button on form2 textbox1.text = text; } } form2.cs public partial class form2 : form { public delegate void textenteredhandler(string text); public event textenteredhandler ontextenteredhandler; public form2() { initializecomponent(); } private v

Android Custom Listview Image loading without libraries -

i want load images sd card custom listview. listview contains image view , text view. know there many libraries can me achieve this, i want without using such libraries. problem :- i loading images async task. calling async task inside getview(). images in last row. is, if there 3 images in folder, image shown in 3rd item of listview. below code :- public class myphotoadapter extends baseadapter { private activity callingactivity; private arraylist<string> filepaths = new arraylist<string>();//contains file path of images arraylist<bitmap> myimages = new arraylist<bitmap>(); private int imagewidth; int position; imageview iv_photo; textview tv_address; public myphotoadapter(activity activity,arraylist<string> paths,int width) { this.callingactivity = activity; this.filepaths = paths; this.imagewidth = width; } @override public int getcount() { return filepath

mysql - Return NULL or Empty Values When Data Doesn't Exist -

i have query returns customer info, billing info, , stores shopped @ info. i'm joining on cust_id key each table. of jennifer's (customer) information comes fine has data in each field. have situation susan (customer) doesn't return because 1 of store_names doesn't have location. how modify query show susan if here store doesn't have location? therefore null or empty value. thank in advance.. select distinct a.first_name, a.last_name, a.customer_no, b.bill_type, b.bill_date, c.store_names, c.store_location customer inner join billing b on a.cust_id = b.cust_id inner join storedetail c on a.custid = c.custid it's called outer join. returns null tables out matching values. select distinct a.first_name, a.last_name, a.customer_no, b.bill_type, b.bill_date, c.store_names, c.store_location customer

hadoop - How redistribute data blocks after its reserved has been changed -

i have hadoop 2.7.1. , decided free couple gigs on 1 data node. i changed hdfs-site.xml (defined dfs.datanode.du.reserved) on node , restarted datanode process. hadoop datanode summary page started show node free space fallen 0 still don't notice data relocation. what can relocated datablocks nodes off limit now. i found command suits me: $ hadoop/bin/hdfs balancer

sprite kit - How to determine if SKTexture uses an @2x or @3x image? -

is there way determine whether existing sktexture uses @2x or @3x image version? i @ texture's size , compare them wondering if there's more elegant way it, preferably without using uiimage. here's solution should work ios 9 , os x 10.11: cgimageref imageref = texture.cgimage; cgfloat *scale = cgimagegetwidth(imageref) / [texture size].width; cgimagerelease(imageref); // not sure if need line?

SQL query with 200+ Where criteria is too complex (Access 2013) -

so i've never worked sql before, pretty know playing around access's query designer , looking @ resulting sql code. i'm pretty sure i'm not doing efficiently. here's skinny: -i have database called "spc data" has measured data each component on each circuit board build. -i want write 1 sql query fetch around 500 rows based on combinations of barcodes , component data. -the query built dynamically in vba macro elsewhere, , looks now: select * [spc data] ((([spc data].barcode)=1504803581) , (([spc data].[component id]) '*r56')) or ((([spc data].barcode)=1433700392) , (([spc data].[component id]) '*c15')) or ((([spc data].barcode)=1433700664) , (([spc data].[component id]) '*r56')) or ((([spc data].barcode)=1433700486) , (([spc data].[component id]) '*r56')) or ... 220 more lines of criteria i feel shouldn't memory-intensive, access complains query complex unless pare query down around 60 or'd criteri

r - Make a histogram who's frequency is a value in the row -

Image
how can make histogram each row below represented bar? eg, x axis "2012-10-02" , y axis "126", "2012-10-03" , y axis "11352"... , on. the 'date' variable date vector. date steps 1 2012-10-02 126 2 2012-10-03 11352 3 2012-10-04 12116 4 2012-10-05 13294 5 2012-10-06 15420 6 2012-10-07 11015 7 2012-10-09 12811 8 2012-10-10 9900 9 2012-10-11 10304 10 2012-10-12 17382 thank you this not histogram. you've aggregated counts date. barplot(df$steps, names = df$date, xlab = "date", ylab = "steps", main = "your title here")

c# - Binaries (bin) not updating on server -

i working on project in visual studio under source control. changed assembly name , therefore name of assembly dll changed. if clean solution , build dlls updated in bin held locally. not have bin in source control. deploying server testing using msbuild. getting error when go website on server because appears dlls on server not being updated. when use msbuild, have 'clean workspace' set 'all', should clean solution , build again on server. doesn't appear happening. cannot find bin directory on server check either. thanks help! sometimes when msbuild or webdeploy needs overwrite old executable/library fails because process still accessing it, msbuild doesn't lot let know. if have access server go directory (usually c:\inetpub\wwwroot\\bin) , try remove old files (may require killing w3m process) , redeploy.

javascript - ng-repeat appending data multiple times -

html <div ng-app="templeapp" ng-controller="templelist"> <div ng-repeat="temple in temples track $index" > <h2>{{temple.strtemplename}}</h2> <h4>{{temple.strtempledescription}}</h4> <h4>5km current location</h4> </div> </div> js var templeapp = angular.module('templeapp', []) .controller('templelist',function($scope,$http){ $scope.temples = [{"_id":"new","strtemplename":"temple 1 name","strtempledescription":"temple 1 description","strcontactnumber":"+91899999999","strtemplelocation":"chennai","itemplerating":5,"strcontactpersonname":"","strtemplecoordinates":""}] ; $http.get("https://gist.githubusercontent.com/vigneshvdm

GCM works fine on Android but not working on iOS -

Image
i've succefuly implemented gcm android when tried implement ios version won't push messages. i got gcm token @ ios version, , sent messages (i used postman). got succesful response , unique message id no push recieved. i've been struggling few days. i tried create new gcm project , running gcm examples ios nothing works. i'm using same account ios , android same apikey ofcourse. postman code: { "collapse_key": "score_update", "time_to_live": 108, "delay_while_idle": true, "data": { "score": "4x8", "time": "15:16.2342" }, "registration_ids":["my token"], } what missing? i had same problem, , it's fixed using content_available , priority options shown in below documentation: you should send "content_available":true , , "priority":&

HTML 5 Audio tag: play concatenated opus file in ogg container -

i have 2 sound files saved opus in ogg container. i've concatenated them using simple technique: append binary data of file b file a. can play new file vlc media player, html audio tag recognizes first part (original file a) of concatenated file. is there way overcome problem without touching whole binary data (e.g. removing old header , create 1 new file). regards, philipp

php - What is the difference betweed getcwd and __DIR__? -

dir magic constant stated in php docs . getcwd() current working directory according php docs . my use case is: // index.php file require_once __dir__ . '/vendor/autoload.php'; $app = new silex\application(); $app['debug'] = true; $app->get('/{name}', function($name) use($app) { return $app->sendfile(__dir__ . '/web/source/index.php'); }); i don't understand why need either of these mechanisms should able use relative paths. however code fails out it. __dir__ executing file is. getcwd() current directory php file executing from. remember on server , not client , need mindful of directory working from. this can change. see here more on concept.

python - Is it possible that Precision-Recall curve or a ROC curve is a horizontal line? -

Image
i working on binary classification task on imbalanced data. since accuracy not meaningful in case. use scikit-learn compute precision-recall curve , roc curve in order evaluate model performance. but found both of curves horizontal line when use random forest lot of estimators, happens when use sgd classifier fit it. the roc chart following: and precision-recall chart: since random forest behaves randomly, don't horizontal line in every run, regular roc , pr curve. horizontal line more common. is normal? or made mistakes in code? here snippet of code: classifier.fit(x_train, y_train) try: scores = classifier.decision_function(x_test) except: scores = classifier.predict_proba(x_test)[:,1] precision, recall, _ = precision_recall_curve(y_test, scores, pos_label=1) average_precision = average_precision_score(y_test, scores) plt.plot(recall, precision, label='area = %0.2f' % average_precision, color="green") plt.xlim([0.0, 1.0]) plt.yl

php - Simple SELECT, GROUP, ORDER BY query not behaving as expected -

Image
i want output cities in db , display logo of agents in each city (company_name name of image) in screenshot can see there 1 agent in head office , 3 in leighton buzzard. select query below gives me 2 lines don't need. have changed query group remove 2nd , 3rd results displays 2 results want, 2 arpad logos. want 3 leighton buzzard logos display under single leighton buzzard heading. i have tried using distinct on 'city' seems stop query altogether. any appreciated. "select city, company_name memberlogin_members order city asc" $sql = "select city, company_name memberlogin_members group city asc "; $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_assoc($result)) { $id = $row["id"]; $office = $row["city"]; $agent = $row["company_name"]; $coverage.='<div id="officecoverage" class="fluid "><h3

java - Passing DateTime to string for SQL -

i using datetimepicker class gui building, need use value selected user part of future sql query, cant seem datetime value string pass database. the datetimepicker class import org.jdesktop.swingx.calendar.singledayselectionmodel; import org.jdesktop.swingx.jxdatepicker; import javax.swing.*; import javax.swing.text.defaultformatterfactory; import javax.swing.text.dateformatter; import java.text.dateformat; import java.text.parseexception; import java.util.*; import java.awt.*; /** * licensed under lgpl. license can found here: http://www.gnu.org/licenses/lgpl-3.0.txt * * provided is. if have questions please direct them charlie.hubbard @ gmail dot know what. */ public class datetimepicker extends jxdatepicker { private jspinner timespinner; private jpanel timepanel; private dateformat timeformat; public datetimepicker() { super(); getmonthview().setselectionmodel(new singledayselectionmodel()); } public datetimepicker( date d

pointers - C++ Parallel Arrays -

in parallel array can not see or figure out why printing memory address instead of values entered. ask c++ gods enlighten me , point me tutorials issue can learn from. code below. #include <iostream> #include <ctime> #include <cstdlib> #include <iomanip> #include <string> #include <ios> using namespace std; // assign constant const int rowsize = 6; const int columnsize = 4; void displaywelcome() { cout << "\tcorporation x\n"; cout << "quartily reports 6 entities\n"; cout << "showing highest average out of six\n"; cout << endl; } // assign words in row of 6 string* entitiesarray(string(entities)[rowsize]) { string entitiesname[rowsize] = {"east ","west ","central ","midwest" ,"south ","south east "}; //string entitiesname; for(int i=0; < rowsize; i++) { cout << entitiesname[i] &l

Lowercase a field in namedtuple in python -

i have namedtuple redefined __str__() class mytuple(namedtuple('mytuple', 'field1 field2')): __slots__ = () def __str__(self): return '{}:{}'.format(self.field1, self.field2) every time create instance lowercase value of first field get: >>>s = mytuple('foo','bar') >>>print s foo:bar instead of foo:bar modifying in __str__() not solution in case. you can override __new__ static method , apply lowercasing there: class mytuple(namedtuple('mytuple', 'field1 field2')): __slots__ = () def __new__(cls, field1, field2): """create new instance of mytuple(field1, field2)""" return super(mytuple, cls).__new__(cls, field1.lower(

r - Setting xlim for rbokeh plot inside shiny application -

i'm using rbokeh package r . i've been having results integrating shiny app. want integrate feature daterangeinput select date range chart(it time series data). ##necessary packages install.packages("shiny") install.packages("devtools") install.packages("dplyr") library(devtools) devtools::install_github("ramnathv/htmlwidgets") devtools::install_github("bokeh/rbokeh") library(rbokeh) library(dplyr) library(shiny) #example data set james<-mtcars[c("mpg")] james$date<-seq(from=as.date("2013-05-16"),to=as.date("2013-06-16"),by="days") james$index<-1:4 #shiny app shiny_example <- function(chart_data = james){ date_minmax <- range(chart_data$date) shinyapp( ui=fluidpage( titlepanel("a plot"), sidebarlayout( sidebarpanel( textinput("index","enter index 1 16",value=1), uioutput("date_ra

Ios Cordova App Crashes while playing audio -

i creating game in cordova. crashes while playing audio. need play 1 sound background music , other 1 game sound(on button click audio). implemented below code crashes in ipad <audio id="musicsound" src="audio/music.mp3" type="audio/mp3" ></audio> <audio id="joinsound" src="audio/join.mp3" type="audio/mp3" ></audio> playaudio('musicsound'); function playaudio(id) { var audioelement = document.getelementbyid(id); var url = audioelement.getattribute('src'); mediaflag = "true"; my_media = new media(url, // success callback function () { console.log("playaudio():audio success"); }, // error callback function (err) { console.log("playaudio():audio error: " + err); } ); // play audio my_media.play(); } function pauseaudio() { if

plsql - Invalid cursor exception in 2nd iteration -

i getting invalid cursor exception while iterating 2nd time. load_table_ref_cursor(v_tariff_table_rows); -- v_tariff_table_rows sys_refcursor. when doing iteration below. load_table_ref_cursor(v_tariff_table_rows); loop fetch v_tariff_table_rows tak_row; exit when v_tariff_table_rows%notfound; end loop; the control inside loop going 1st time fine , throwing exception invalid cursor @ fetch statement 2nd time. could tell whats wrong 2nd iteration. invalid cursor error produced when; fetch cursor before opening cursor. fetch cursor after closing cursor. close cursor before opening cursor. load_table_ref_cursor(v_tariff_table_rows); open v_tariff_table_rows; -- use v_tariff_table_rows close v_tariff_table_rows;

php - How to remove ASCII codes from text via notepad/Sublime or Excel -

i having big trouble ascii commas , quotations marks causing error in db importing. whenever add text website, copies ascii codes also. example: ( “ ) quotation mark different ( " ) ( “ ) <--this quotation mark ascii character causing error in db importing , every time need check , replace default quotation mark ( " ) any idea please? method #1 you can notepad++ . open file want replace click ctrl + h . in field find what: type “ in field replace with: type normal quotation mark " click replace all button. method #2 you can use [^\x00-\x7f]+ expression. open notepad ++ click ctrl + f select regular expression in find what: field paste [^\x00-\x7f]+ click find next it find non ascii characters. can easy delete / replace them. method #3 open notepat++ click search click find characters in range... select non-ascii characters (128-255) click find working method #2.

ios - Reload UITableView To Contain Newly inserted Data -

i have secondviewcontroller sliding panel has uitableview , populates nsarray data returned "getnotes" function viewcontroller.running first time gets data when new data inserted uitableview not update though nsarray "n" contains new data. here secondviewcontroller.h- #import <uikit/uikit.h> @interface secondviewcontroller:uiviewcontroller<uitableviewdelegate,uitableviewdatasource> { nsarray *n; } @property (strong, nonatomic) iboutlet uitableview *tableview; -(void)gets; @end here secondviewcontroller.m- #import "secondviewcontroller.h" #import "viewcontroller.h" @interface secondviewcontroller () @end @implementation secondviewcontroller - (void)viewdidload { [super viewdidload]; [self gets]; } - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. } #pragma table view methods -(void)gets{ viewcontroller *dba=[[viewco

javascript - sass set width as variable if its not known -

i'm using sass in project , want set variable equal 0.1*width of content element. width in sass not declare, mean width set in js (window).height * x (it example), in css file there no declaration of content{width: x;} to more specyfic have 1 content, have width , height generated in js other things in sass: .content{background:red; padding:10px;} and want create variable 10% of width of .content, , variable 12% of height of element make flexible layout in (i want make grid on .content ), , can see there no declaration of elements in sass mean width , height. is there possibility create variables ( $widthcell = .content.width ) ?

jquery - CSS transform gets overwritten -

i facing following problem: i have 2 functions apply css transform element (with jquery), without knowing eachother , called @ different times. however both overwrite eachother. an example can found here . when click rotate link, translate overwritten , rotation applyed. keep both transforms. i assume not jquery bug, how make work not overwrite eachother ? box.css({ '-ms-transform': 'translate(50px,100px)', /* ie 9 */ '-webkit-transform': 'translate(50px,100px)', /* safari */ 'transform': 'translate(50px,100px)' }); rotateit.on('click', function() { box.css({ '-ms-transform': 'rotate(45deg)', /* ie 9 */ '-webkit-transform': 'rotate(45deg)', /* safari */ 'transform': 'rotate(45deg)' }); }); you overwriting transform property other if both classes of same element. to use both transform rotate , translate can this yourselector{ transform: rotate(4

c# - Replace part of large XML file -

i have large xml file, , need replace elements name (and inner elements) element. example - if element e : <a> <b></b> <e> <b></b> <c></c> </e> </a> after replace e elem : <a> <b></b> <elem></elem> </a> update: try use xdocument xml size more 2gb , have systemoutofmemoryexception update2: code, xml not transform xmlreader reader = xmlreader.create("xml_file.xml"); xmlwriter wr = xmlwriter.create(console.out); while (reader.read()) { if (reader.nodetype == xmlnodetype.element && reader.name == "e") { wr.writeelementstring("elem", "val1"); reader.readsubtree(); } wr.writenode(reader, false); } wr.close(); update 3: <a> <b></b> <e> <b></b> <c></c> </e> <i> <e> <b></b>

objective c - iOS fetch UIButton current UIControlEventType at @selector -

let abutton = uibutton() a.addtarget(self, action: "handler:", forcontrolevents: .touchupinside) func handler(btn: uibutton) { //is there anyway can know controlevent "touchupinside" in method? } as example above, wanna know controleventtype @ @selector, not found correct api or it's impossible? you can either provide different methods different control events: a.addtarget(self, action: "touchdownhandler:", forcontrolevents: .touchdown) a.addtarget(self, action: "touchuphandler:", forcontrolevents: .touchupinside) func touchdownhandler(btn: uibutton) { } func touchuphandler(btn: uibutton) { } as noted in another answer can event in handler , inspect type of touch, here in swift: a.addtarget(self, action: "handletouch:event:", forcontrolevents: .alltouchevents) // ... func handletouch(button: uibutton, event: uievent) { if let touch = event.touchesforview(button)?.first as? uitouch { switch

macros - Initialize array after declaring in C -

i trying following getting following error: "error: expected expression before { token test_stubs.h #define signature 0x78,0x9c test.c #include "test_stubs.h" static unsigned myarray[100]; static void setup(void) { myarray = {signature}; } edit follow on question: is there way assign individual values in #define specific indexes of myarray? instance... #include "test_stubs.h" static unsigned myarray[100]; static void setup(void) { myarray[0] = signature[0]; //0x78 myarray[1] = signature[1]; //0x9c } clearly above code not code signature neither array or pointer. as per c syntax rules, can initialize array using brace enclosed initializer list @ time of definition. afterwards, have initialize element element, using loop, or, if need initialize elements same value, can consider using memset() . edit: no, mentioned in comments, per code snippet, signature neither array name, nor represent array type,

Stream Binary data to javascript html from Java ServerSocket -

i trying stream binary data, html page using java server built using serversocket. able achieve using xmlhttprequest, observing big delay in receiving end. please share better way same avoid delay. built websocket server using java not able receive data binary in javascript. i assume didn't specify content length of binary stream and/or not close servlet output stream. please consider following code protected void doget(httpservletrequest request,httpservletresponse response) throws servletexception, ioexception { byte[] binarydata = createbinarycontent(); outputstream out = response.getoutputstream(); response.setcontenttype("application/octet-stream"); response.setcontentlength(binarydata.length); out.write(binarydata); out.close(); }

highcharts - rangeSelector: change date beyond zoomed time range -

i build chart lazy loading example ( http://www.highcharts.com/stock/demo/lazy-loading ) having input fields of range selector. when zoom in fine. change selected range using input fields. not able change input values beyond zoomed area despite fact have more data visible in navigator. in setextremes function doing calculations: dx.ipfixgraphmodule.prototype.setextremes = function(e) { var fromtime, maxzoom = 30 * 60 * 1000, = new date().gettime(); if (e.min) { fromtime = e.min; } else { fromtime = e.datamin; } fromtime = math.round(fromtime); var diff = - fromtime; // -1 month = max 1 week zoom if (diff >= 2592000000) { maxzoom = 7 * 24 * 60 * 60 * 1000; } // -1 week = max 12 hour zoom else if (diff >= 604800000) { maxzoom = 12 * 60 * 60 * 1000; } // refers axis // @see http://api.highcharts.com/highstock#axis.update this.update({ minrange: maxzoom }, false); }; but values receive in e.min , e.max not original input values corrected d

android - Retrieve and parse JSON from multiple URLs and add to listview -

i started learning android week ago , decided write simple android application website bhooka.in . used koush/ion api retrieve json data url. here's problem - have single json file, containing multiple json urls. tried retrieve jsons in loop, doesn't seem work. here's code: future<jsonobject> loading; private void load() { // don't attempt load more if load in progress if (loading != null && !loading.isdone() && !loading.iscancelled()) return; // load tweets string url = "http://bhooka.in/web_services_json_helper.php?mode=fetch_locations&user_agent=in.bhooka.bhooka&city_id=4"; loading = ion.with(this) .load(url) .asjsonobject() .setcallback(new futurecallback<jsonobject>() { @override public void oncompleted(exception e, jsonobject result) { // called onto ui thread, no activity.runonuithread or handl