Posts

Showing posts from April, 2010

elasticsearch - Migrating to Aggregations from Date histogram facet builder with querystring -

i trying migrate aggregations date histogram facet builder going through following url. https://www.elastic.co/guide/en/elasticsearch/reference/current/search-facets-migrating-to-aggs.html i able convert few queries aggregations , got proper results, throwing exception while converting following facet query aggregations query. facet : { "facets": { "lapp442.corp.com:timer_micro.99percentile": { "date_histogram": { "key_field": "@timestamp", "value_field": "timer_micro.99percentile", "interval": "30s" }, "facet_filter": { "query": { "filtered": { "query": { "query_string": { "query": "lapp442.corp.com"

javascript - Passed function has a variable not working -

i have below javascript getting error: uncaught typeerror: responsehandler not function var message = { initialmessagelist: function(profile_id) { $('.messages-list profile'+ profile_id).html = '<div class="message-loader profile"+ profile_id><i class="fa fa-spinner fa-spin"></i></div>'; message.fetchmessagelist(profile_id, message.initialmessagelisthandler('', profile_id)); } initialmessagelisthandler: function(data, profile_id) { $('.messages-list .message-loader profile'+ profile_id).remove(); $('.messages-list profile'+ profile_id).html(message.getmessagelisthtml(data)); message.bindmessagelist(); $('.open-message profile'+ profile_id).first().click(); }, fetchmessagelist: function(query, responsehandler) { $.ajax({ url: '/app/messages/fetch/'

How to show the long blob image from database in phpexcel? -

i have table store data of image in long blob type, how retrieve image show in phpexcel? sample of code: $order = "select * tblorder"; $tblorder = $conn->query($order); $row_order = $tblorder->fetch(pdo::fetch_assoc); $image =$row_order["image"]; $data = base64_encode($image); $objdrawing = new phpexcel_worksheet_memorydrawing(); $objdrawing->setname('image'); $objdrawing->setdescription('image'); $objdrawing->getindexedfilename($data); $objdrawing->setrenderingfunction(phpexcel_worksheet_memorydrawing::rendering_jpeg); $objdrawing->setmimetype(phpexcel_worksheet_memorydrawing::mimetype_default); $objdrawing->setcoordinates('a85'); $objdrawing->setworksheet($sheet->getactivesheet());

mongodb - Modify default value of field from mongo-engine django -

i have following models class xyz(document): done_project_categories = listfield(stringfield(), default=['all', 'residential', 'corporate', 'commercial']) i want change default value following , migrate onto mongodb class xyz(document): done_project_categories = listfield(stringfield(), default=['all', 'residential', 'corporate', 'commercial', 'cafes']) i not able migrate onto datebase , looking exact command migrate changes onto mongodb. i using mongo-engine interact database django.

javascript - How to add an empty data point to a linechart on Chart.js? -

i'm trying add empty data points throughout line chart using chart.js. have this: var data = { labels: [ "1","2","3","4","5","6","7","8","9","10" ], datasets: [ { label: "traffic", data: null,null,20,40,null,null,null,10,20,null } ] }; the problem linechart recognizes first 2 "nulls" being empty data points , doesn't display them. however, nulls come after, line (connecting previous , next valid datapoint) shown, makes seem if "null"-datapoints exist. there way not display null-values in linecharts? (similar canvas.js offer: http://canvasjs.com/docs/charts/basics-of-creating-html5-chart/empty-null-data-points-chart/ ) i read through chart.js documentation , stackoverflow not find answer. can me?

android - Is it possible to mediate Interstitial ads using AdMob? -

i have set admob mediation in android app, it's working fine, want admob mediate interstitial ads other providers. unable find or documentation on that, asking here. this code have banner mediation: mmsdk.initialize(this); millennialextras = new millennialadapterextras(); inmobiextras = new inmobiadapterextras(); mopubextras = new mopubextras(); flurryagent.init(this, "some id"); flurryextras = new flurryadapterextras(); madview = (adview) findviewbyid(r.id.adview); adrequest = new adrequest.builder() .addnetworkextras(millennialextras) .addnetworkextras(inmobiextras) .addnetworkextras(mopubextras) .build(); madview.loadad(adrequest); and ads start rolling. now interstitials, trying this: in oncreate have this: interstitialad = new interstitialad(mainactivity.this); interstitialad.setadunitid("some id"); adrequestinterstitial = new adrequest.builder(

ios - Working with APNS in production apps -

using apns in small environments , low volume notifications not problem. the problem (for me @ least) how work apns limitations in large, high volume of notifications environment. apns has limitations (by design) make harder smooth work constant connecting , disconnecting apns might considered dos attack. leads me believe need batch-send notifications every few seconds , not have "real time" sending there no knowledge if notification has arrived or sent succesfully. when there error, returned, , when returned might not immediate. when notification causes error (for example due bad token) connection closed apns, , rest of notifications in batch won't sent destination, might still sent apns , lost forever (no feedback on success, there no knowledge happened them). how real-life production apps work apns work around mentioned problems? should save notifications send , each check if error returned? should put them in queue? should face fact there notifications

What is reason to get python model conversion error? -

modelconversionerror: {'subscriber': {'contacts': [u'please use mapping field or contacts instance instead of list.']} i getting modelconversionerror above. have correct error , reason getting that? class contacts(model): communication_number2 = stringtype(min_length=1, max_length=50) communication_type2 = stringtype(min_length=1, max_length=50) class subscriber(member): master_policy_number = stringtype() address = modeltype(address) contacts = modeltype(contacts)

optimization - How to increase the performance of the library on TI Sitara am335x? -

i using openssl library version 1.0.2 encryption , decryption of files in project. encryption , decryption functions take time , whole application performance gets worse. i using ti sitara am335x processor , has cryptographic accelerator in it. not giving performance because of system/application constraint. tried optimize openssl library neon coprocessor (auto vectorization) using following flags -o3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -ftree-vectorize -mfloat-abi=hard even 1 failing give performance. apart optimizing application, how can deal library side?

javascript - google chrome DOM manipulation -

i use <a class="waves-effect waves-light btn disabled">submit</a> to prevent users submitting form if not input according validation rules. however, when inspect element through google chrome , remove disabled class source. boom, button turns active button. so wondering how prevent this? thanks. there no disabled attribute tag. if want disable hyperlink change js e.g span tag. here have more solutions disabled href tag

regex - Script to add line with part of the pattern used to find the line -

i'd parse *.php files, , each line $res = $db -> query($queryvar); i need get: file_put_contents('php://stderr', print_r($queryvar, true)); $res = $db -> query($queryvar); the name of variable $queryvar may change! need code! my initial idea: find -not -path "*/\." -name "*.php" -type f -print0 | xargs -0 sed -i 's,something,something,' but seems not possible name of query variable sed. i started looking @ perl: perl: append line after last line match pattern (but incrementing part of pattern) but able this: perl -pe 's/(-> query\(.*\))/aaaaa $1 aaaaa\n$1/' < filename.php with 2 problems: result on standard output, need sed edit original file, call find | xargs , anyway whole found line , not variable: $res = $db aaaaa -> query( $sql) aaaaa -> query( $sql); given file named filename.php , can run following command: perl -pi -e 's/^(.+-> query\((.+?)\).*)$/file_put_con

android - How to set different size of navigation drawer in different values folder -

i want resize width of navigation drawer between layout-large , layout-xlarge , i've created different folders: res/values-sw480dp res/values-sw600dp but doesn't work, tried: res/values-large res/values-xlarge but doesn't work either: <fragment android:id="@+id/fragment_navigation_drawer" android:name="fr.solutis.solutis.fragmentdrawer" android:layout_width="@dimen/nav_drawer_width" android:layout_height="match_parent" android:layout_gravity="start" app:layout="@layout/fragment_navigation_drawer" tools:layout="@layout/fragment_navigation_drawer" /> res/layout/my_layout.xml // layout normal screen size ("default") res/layout-large/my_layout.xml // layout large screen size res/layout-xlarge/my_layout.xml // layout extra-large screen size res/layout-xlarge-land/my_layout.xml // layout extra-large in landscape orien

java - cannot add server(tomcat) to eclipse -

Image
environment : windows + eclipse luna service release 2 (4.4.2) + tomcat 8 + jdk 8 when try add new server eclipse file -> new -> other -> server i choice "tomcat v8.0 server" in "new server" dialog, , have added "server runtime environments". there error message " selected server type not support remote hosts". what can error? thanks everybody! i solved changing server runtime environments in eclipse, preferences => server => runtime environments then select tomcat type. can remove server , add new server runtime environment or edit existing 1 giving correct tomcat installation path. won't give "the selected server type not support remote hosts" error.

sql - Cannot Access Azure DB from powershell -

i'm trying connect azure db , make several changes there powershell. $folder = "c:\depl" $connectionstring = "data source=servername.database.windows.net,1433;initial catalog=configurationdb;user id=username@servername;password=qwerty$5ok;trusted_connection=false;" $datatable = "[configurationdb].[dbo].[parameters]" $con = new-object "system.data.sqlclient.sqlconnection" $con.connectionstring = ($connectionstring) $sqlcmd = new-object "system.data.sqlclient.sqlcommand" $sqlcmd.connection = $con $sqlcmd.commandtimeout = 600000 $con.open() ... other actions ... i't used work without problem, started fall exception: exception calling "open" "0" argument(s): "login failed user 'username'. session has been assigned tracing id of 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'. provide tracing id customer support when need assistance." @ c:\depl\changeparams.ps1:21 char:5 + $

ide - Change Default Indentation in Android Studio & about the indentation terminology -

Image
instead of for (...){ code; } i want: for (...) { code; } i want change default style first one, second style, in android studio. also, please tell me terminology each style? (if there terminology such things). thanks! according changing style of-braces in-android studio , you need change code style in project settings file -> settings -> (project settings) -> code style -> java -> wrapping , brances change braces placement class , method declaration next line (or, on mac, same thing in preferences)

android - Posting a new application on Play store as an update which uses same keytore file,package name etc -

i have hosted android application on play store.i have somehow managed corrupt source project , using page on eclipse. question if create new fresh project using same package name, same name of application , use same keystore file signing application , version update.can add play store update existing hosted application yes,you can. below google developer help sections says. the package name of updated apk needs same current version. the version code needs greater current version. learn more versioning applications. the updated apk needs signed same signature current version. if pass these requirement, doesn't matter how many times have created same project. not worry. happy coding!!

gsp - Changes in server view is not working in Grails -

i working grails 2.4.2 , tomcat 7 in debian server. suppose need change label of field. if change label in server's view directory not working. all have creating war again , deploy. far know, if changes made in views no need create war , deploy again. in opinion, best way deal dynamic content externalize it. save dynamic content external file can modify it. grails' reloadable configuration of great help. see http://www.tothenew.com/blog/externalize-and-reload-grails-configuration-dynamically/ idea how done.

ios - Objective-C Memory Issue with NSArray literal using NSNumber object -

i have started out objective-c , trying understand memory management. came across peculiar problem yesterday causing memory leak of on 150mb! traced down piece of code creating nsarray literal of nsnumbers. managed solve issue using nsmutablearray (using addobject), haven't been able grasp concept why 1 method works , other doesn't. love better understanding of memory management explain concept behind can avoid such mistakes in future. to better illustrate question, let me provide code snippets. instance, have function creates nsarray of few nsnumbers , returns , gets called many times: -(nsarray *)getnsnumberarray { float num1 = 23.56; float num2 = 75.34; float num3 = 223.56; nsarray *numarray = @[[nsnumber numberwithfloat:num1], [nsnumber numberwithfloat:num2], [nsnumber numberwithfloat:num3]]; return numarray; } -(void)causememoryleak { (int = 0; < 2000000; i++) { nsarray *recieverarray = [self getnsnumberarray]; } } thi

javascript - JSONP Works on browsing to URL but not on refresh -

on page have 2 javascripts. first script (a.js) appends script head of parent page in order pass jsonp. first script takes jsonp array data , puts array second script use. when go hard url works fine. if f5 doesn't work. if add alert first script right after jsonp done works. so, guessing when refreshing, reason, happens faster , therefore appending of script doesn't have chance happen , array never receives data. how can fix this? main page: <script src="a.js"></script> <script type="text/javascript"> arrayvalueonmainpage = arrayvalue.firstvalue </script> a.js: //fail safe default arrayvalue = {"firstvalue":["null"]}; function initiate(data){ arrayvalue = data; } function loadjsonp(url){ var head = document.getelementsbytagname('head')[0]; var script = document.createelement('script'); script.type = 'text/javascript'; script.src = url; head.appe

c++ - Someone knows why there's this segmentation fault in my code? -

i'm implementing graph in c++ , i'm having segmentation fault when try print adjacency list, knows why? doing wrong? sorry bad english. #include <iostream> #include <vector> #include <list> #include <string> using namespace std; class vertex; class edge{ public: edge(vertex *org, vertex *dest, int weight){ origem = org; destino = dest; peso = weight; } vertex* getorigem(){return origem;} vertex* getdestino(){return destino;} int getpeso(){return peso;} private: vertex* origem; vertex* destino; int peso; }; class vertex{ public: vertex(string id){ name = id; } void addedge(vertex *v, int peso){ edge newedge(this, v, peso); edges.push_back(newedge); } void printedges(){ cout << name << ":" << endl; (int = 0; < edges.size(); i++) { edge e = edges[i]; cout << e.getdestin

objective c - Unable to set different video duration for capture and edit video in ios -

i working on project in need set 1 minute video recording user should , edit , select video of 30 second duration. below code used enable 30 second maximum editing time. -(bool)startcameracontrollerfromviewcontroller: (uiviewcontroller*) controller usingdelegate: (id <uiimagepickercontrollerdelegate, uinavigationcontrollerdelegate>) delegate { if (([uiimagepickercontroller issourcetypeavailable:uiimagepickercontrollersourcetypecamera] == no) || (delegate == nil) || (controller == nil)) { return no; } uiimagepickercontroller *cameraui = [[uiimagepickercontroller alloc] init]; cameraui.sourcetype = uiimagepickercontrollersourcetypecamera; // displays control allows user choose movie capture cameraui.mediatypes = [[nsarray alloc] initwithobjects: (nsstring *) kuttypemovie, nil]; // hides controls moving & scaling pictures, or // trimming m

scala - java.util.regex.PatternSyntaxException when using sbt docker:publishLocal -

i created new project sub-projects , enabled dockerplugin each sub-project. however, when execute sbt docker:publishlocal , got across exception below: [info] wrote d:\programmingstyle\code\milkyway\frontend\target\scala-2.11\frontend_2.11-1.0-snapshot.pom java.util.regex.patternsyntaxexception: unexpected internal error near index 1 \ ^ @ java.util.regex.pattern.error(pattern.java:1955) @ java.util.regex.pattern.compile(pattern.java:1702) @ java.util.regex.pattern.<init>(pattern.java:1351) @ java.util.regex.pattern.compile(pattern.java:1028) @ java.lang.string.split(string.java:2368) @ java.lang.string.split(string.java:2410) @ com.typesafe.sbt.packager.docker.dockerplugin$.com$typesafe$sbt$packager$docker$dockerplugin$$makeadd(dockerplugin.scala:152) @ com.typesafe.sbt.packager.docker.dockerplugin$$anonfun$projectsettings$8.apply(dockerplugin.scala:79) @ com.typesafe.sbt.packager.docker.dockerplugin$$anonfun$projectsettings$8.apply(dock

TripleDes encrypt difference python code and openssl -

i want encrpt using tripledes-cbc-pkcs5. i testing python code , openssql encrypting. key = md5("card") using pydes.py: def enc(data): m = hashlib.md5() m.update("card") key = m.digest() k = triple_des(key, cbc, "\0\0\0\0\0\0\0\0", pad=none, padmode=pad_pkcs5) d = k.encrypt(data=data, padmode=pad_pkcs5) return base64.b64encode(d) enc("b47650") result : h93d5if6myu= using openssl: > cat test b47650 > openssl des3 -in test.file -e -a -p -nosalt -k 5dd2199ad68327cc76d583b057aee7d5 -iv 00000000 key=5dd2199ad68327cc76d583b057aee7d50000000000000000 iv =0000000000000000 mmsbm/mbxju= why different?

elasticsearch - Mongo connector not synchronizing data between mongodb and elastic search -

i trying use mongo connector import data mongo db elastic search. have followed instructions given in link: https://github.com/10gen-labs/mongo-connector/wiki/usage-with-elasticsearch mongo db : 2.4.12 connector version:2.0.3 elastic search version: 1.5.2 we having issue data not being imported mongodb elastic search. queries: what best way integrate mongodb elastic search , synchronize real time data between them in production how setup synchronization-steps how create 1 time indexes. you can use mongo-db-river plugin sync data mongodb elasticsearch the following refernce link give more detail river plugin. mongodb river plugin reference if need more on please ask.

c# - Validate a list in a custom validation attribute -

using custom validation attribute, i'm trying validate list of objects. class shown below: myclass . in custom attribute, i'm able covert object value into list of objects, how can access properties, id , name within objects? i understand put attribute directly on the myclass properties, need check couple things before validation. first, need check if number of items in list greater one. then, if count greater one, need check if both id , name null. my thought easier validate entire list in 1 attribute. if did place attributes on myclass properties, still need access values within list. if list passed value parameter of isvalid list items within value. if put attributes on myclass properties need values way. i've been able single values code below, i'm unable list of values. bottom line: need way access values within list either object value parameter or validationcontext validationcontext parameter. getting single value (not list of values):

haskell - Converting an untyped AST for a simple typed language into a GADT -

i have adt representing ast simple language: data uterm = utrue | ufalse | uif uterm uterm uterm | uzero | usucc uterm | uiszero uterm this data structure can represent invalid terms don't follow type rules of language, uiszero ufalse , i'd use gadt enforces well-typedness: {-# language gadts #-} data tterm ttrue :: tterm bool tfalse :: tterm bool tif :: tterm bool -> tterm -> tterm -> tterm tzero :: tterm int tsucc :: tterm int -> tterm int tiszero :: tterm int -> tterm bool my problem type check uterm , convert tterm. first thought uterm -> maybe (tterm a) , of course doesn't work because it's not valid a s. don't know type be, because don't know if a going int or bool. thought write different type checking function each of possible values of a : import control.applicative typecheckbool :: uterm -> maybe (tterm bool) typecheckbool utrue = ttrue typecheckbool ufalse = tfalse typeche

string - How to move around a matriz in Assembly language using SI and DI as pointers? -

i'm trying create simple text editor i'm not sure how save user input strings. how move , control positions within each string? also, how control when go next string using si? far have : matriz: mov si, 0 mov si, offset direc ; directions mov di, 0 mov di, offset fila1 ; [si+0] 1st row mov word ptr[si], di add si, 2 mov di, offset fila2 ; [si+2] 2nd row mov word ptr[si], di add si, 2 mov di, offset fila3 ; [si+4] 3rd row mov word ptr[si], di add si, 2 mov di, offset fila4 ; [si+6] 4th row mov word ptr[si], di add si, 2 mov di, offset fila5 ; [si+8] 5th row mov word ptr[si], di add si, 2 ret ........................... write: mov cx, 1 cycle: mov ah, 2h ; character output int 10h ; display character in dl mov ah, 1h ; keyboard input int 21h ; read character al cmp al, 27 ; esc je fin cmp al, 0 je compararsp

c++ - Which smart pointer to use in Stack implementation? -

from i've understood correctly: scoped_ptr : no overhead, cannot copied or moved. unique_ptr : no overhead, cannot copied, can moved. shared_ptr : overhead (reference counting), can copied. having said that, if there need several owners, shared_ptr should used. now, in program below simple implementation of stack in c++. don't understand type of smart pointer should used. the reason i'm asking question because both unique_ptr shared_ptr cannot copied , i'm doing in implementation of simple stack. i've commented out //here in program i'm using c++ pointers , if read program you'll see how data getting copied in pretty functions. gamestatestack.h #ifndef _h_gamestate_ #define _h_gamestate_ #include <iostream> #include <boost/shared_ptr.hpp> #include <boost/scoped_ptr.hpp> #include <memory> class node { public: std::string gamestate; node * nextgamestate; // here }; class gamestatestack { private: no

ios - How to hide tabbar -

i have changed frame of tabbar in viewcontroller: self.tabbar.frame.origin.y = cgrectgetheight(self.view.frame). but tabbars reset original frame when new viewcontroller pushed. how can hide tabbar when push new viewcontroller? set hidesbottombarwhenpushed yes on uiviewcontroller .

jquery - How to attach a popover to fontawesome icon -

ok, so, have text input box. have fontawesome icons in textbox. i trying trigger popover (from twitter bootstrap 3) box upon click on 1 of fontawesome. nothing seems work. however, catch seems file backbone. or @ least .hamlc here contents of file: %form#new-message-form{:name => 'message'} .input-group.input-group-unstyled %input#content.form-control.chat-input{:name => 'content', :type => 'text', :placeholder => 'your message ...'} %span.input-group-addon %i.fa.fa-paperclip %i.fa.fa-star %i.fa.fa-clock-o .chat-send one of things tried attach id star, this: `%i.fa.fa-star#example` if attach id else outside of .hamlc file, works. but in file above, doesn't. have no clue if it's due fact it's backbone, etc. (i don't know backbone) this jquery attached: (not jquery, ripped off online test it) $(document).ready(function() { $("

inheritance - Python super override object name -

i'm trying extend framework, have this: class a(object): def test(self): print(1) class b(object): def method(self): = a() a.test() class customa(a): def test(self): print(2) class c(b): def method(self): = customa super(c, self).method() c = c() c.method() classes , b framework. i want edit test() a, , make c use new method. in code, example, how can make code print 2 instead of 1? [update] this simple example. want extend this class . instead of create settingspanel , create customsettingspanel but problem i'll need lot of classes, want way make python use customsettingspanel , not settingspanel . there's lot of ways approach problem. if can edit b , refactor instead of hard dependency on a , have accept parameter in ___init___ allow 1 specify class instantiate. like: class b(object): def __init___(self, clazz=a): self.__clazz = clazz def method(self):

Meteor collection2 is allowing numbers as strings -

i starting new meteor project , using collection2 validation. have below schema defined. when insert document title: 4, expect fail since have specified string. not failing. suspect there fundamental aspect of meteor i'm not getting. fyi, if leave out title, expected errors. my schema: timestamps = new mongo.collection('timestamps'); var schemas = {}; schemas.timestamp = new simpleschema({ title: { type: string, label: "title", max: 500, optional: false }, notes: { type: string, label: "notes", max: 1000, optional: true } }); timestamps.attachschema(schemas.timestamp); the following code should fail error saying title needs string. however, not failing, , value being stored string "4". creating timestamp: timestamps.insert({title: 4, comments: "a comment"}); this how publishing , allowing timestamp inserts. meteor.publish("timestamps", function() { return times

asp.net - Conditional C# Ternary Operator statement to execute methods with Void Return Type -

how can use coalescing operator choose method calls depending upon true or false value , follows: request.querystring=="new"? newpage() : oldpage() ; request.querystring=="black"? blackmonie(): request.queystring=="white"? whitemonie():tacs(); instead of common coalescing operator call using stoage variable follows: string s= color=="r"? "red" : "green"; it's not overly clear question, assume newpage() , oldpage() both void methods. so, can't use ternary operator you're proposing without getting lot of messy code returns actions need invoked. and there seems little benefit in trying work built in if , else keywords pretty close want. here suggested use of ?: operator standard if code: request.querystring == "new" ? newpage() : oldpage(); if (request.querystring == "new") newpage(); else oldpage(); that's 7 characters difference. i'd stick standard if

java - Lucene TextField not tokenized -

i saving following title index doc.add(new textfield(title, "button",field.store.yes )); then when search "butto", nothing returns. must search "button" back. have substring of button gives result? using standardanalyzer analyzer = new standardanalyzer(); the standardanalyzer creates token button input text , so, query button matches document. search substring of button, have 2 options. at search-time, can use different query, e.g. prefixquery or wildcardquery . if use query parser, can use butto? or butto* . at index-time, can use different analyzer, emits substrings tokens, example edgengramtokenizer emit [bu, but, butt, butto, button] based on configuration; or ngramtokenizer , emit [bu, ut, tt, to, on] , on configured size(s).

Include Facebook comment wall in a native android app -

i'd have facebook comment wall in native app. facebook android sdk doesnt seem have this, option use web social plugin? should use in webview? means if use facebook login in app there 2 sessions (one app, , 1 plugin)? so question in short, can have facebook-style comment wall without webview? the facebook comment plugin available web. comment feature not included in facebook android sdk.

How to qsub idl job on cluster? -

i'd use qsub submit idl job. there errors. script follows: ##################################### #$ -s /bin/bash ##$ -j y #$ -cwd #$ -m e ### pe size must multiple of 12! ###$ -pe impi4 24 ### wallclock 48 hours #$ -l h_rt=48:00:00 #$ -m emailaddress #$ -n 'name' #$ -o 'name' #$ -e 'name' source ~/.bashrc cd /mydirectory echo "start time:" date idl -e .com file1 -e file2 ##################################### i have source .bashrc first make library in idl work(for reason must in way). need first compile file1 make file2 work smoothly, ie. in normal terminal command line, need .com file1 carriage return file2 no run or anything. here doesn't work, error says idl command not found -e command not found why? tried add \r , !c behand file1 , seemed not working , delete -e before file2 , still not. use suse os. thank @mgalloy 's advice, said pro program .compile file1 file2 end and got errors pro pr

php - Automatically replace values -

i have functions return different predifined values: function a(){ $value = 'mercedes'; replacevalues($value); } function b(){ $value = 'audi'; replacevalues($value); } function c(){ $value = 'bmw'; replacevalues($value); } is there function in php this: function replacevalues($value){ switch($value){ case 'mercedes': echo $value = 'topa' break; case 'audi': echo 'topb' break //and on } } it nice if define array have iterate through (or php function exists) $a = array('mercedes'=>'topa', 'audi' => 'topb'); so expand array or change corresponding replacements. regards the function looking is: array_search $array = array(0 => 'azul', 1 => 'rojo', 2 => 'verde', 3 => 'rojo'); $key = array_search('verde', $array); // $key = 2; $key = array

rails 4 ransack gem, undefined path error -

i have rails 4 app events model want make searchable on variety of fields using ransack gem. my controller action: def index @search = event.ransack(params[:q]) @events = @search.result(distinct: true) end my search form in index.html.erb: <%= search_form_for @search |f| %> <%= f.text_field :name_cont, class: "radius-left expand", placeholder: "event name" %> <% end %> however, in loading page, following error: actionview::template::error (undefined method events_path' #<#:0x007fc08b3fa838>): 1: events 2: 3: <%= search_form_for @search |f| %> 4: <%= f.text_field :name_cont, class: "radius-left expand", placeholder: "event name" %> 5: <% end %> 6: app/views/events/index.html.erb:3:in_app_views_events_index_html_erb___2056451196739971413_70232473324180' when rake routes, get: events_show /events/show(.:format) events#show events_index /events/index(.:forma

javascript - Using Tampermonkey Chrome to loop jquery code that "automatically clicks a specific button" -

update: actual code , interval functions work, still cannot behave tampermonky script. console spit out errors characters aren't part of script. so thing need working in either chrome extension or tampermonkey userscript , i'd 1 happy camper. here's error receive: syntax error @ '********.com auto clicker'! ########################## jshint output: require: (e030) expected identifier , instead saw '<' on line: 2 @ character: 1 require: (e033) expected operator , instead saw '!' on line: 2 @ character: 2 require: (w030) expected assignment or function call , instead saw expression on line: 2 @ character: 2 require: (w033) missing semicolon on line: 2 @ character: 3 require: (w030) expected assignment or function call , instead saw expression on line: 2 @ character: 3 require: (w033) missing semicolon on line: 2 @ character: 10 require: (e030) expected identifier , instead saw '<' on line: 3 @ character: 1 require: (e033) expected

android - Gradle: pros/cons adding dependencies -

Image
what pros/cons adding dependencies in build.gradle , instead of adding them dependent libraries? dependencies { compile project(':library') ... compile 'com.stackoverflow.android:some-great-library:1.0' ... } while working on android projects, i've come across great libraries exact solution i've been looking for. however, need fraction of particular libraries have offer, i'm worried if adding them gradle dependencies overkill . per @commonsware's comment, have more specific questions. does adding dependencies: slow down compilation time @ noticeable rate? increase size of release-apk , debug-apk, as size of added dependency? in gradle dependencies grouped configurations dependency configurations.external dependency dependency on files built outside current build, , stored in repository of kind, such maven central, or corporate maven or ivy repository, or directory in local file system. dependency t