Posts

Showing posts from July, 2012

stop words removal using arrays c# -

i have string array of stopwords , string array of input texts i.e. string[] stopwords = file.readalllines(@"c:\stopwords.txt"); and con.open(); sqlcommand query = con.createcommand(); query.commandtext = "select p_abstract aminer_paper pid between 1 , 500 , datalength(p_abstract) != 0"; sqldatareader reader = query.executereader(); var summary = new list<string>(); while(reader.read()) { summary.add(reader["p_abstract"].tostring()); } reader.close(); string[] input_texts = summary.toarray(); now, have use these stopwords array remove input_texts array. have used following technique not working, weird while accessing both arrays index. example, take first text @ index 0 of input_texts array i.e. input_texts[0] and match word strings in stopwords array i.e. // have match indexes of stopwords[] input_texts[0] stopwords[] then after removing stopwords index 0 text of input_texts array, have repeat texts in input_texts ar

java - Fragment View Return Null -

my view has been returning null though have set view global variable , calling findviewbyid on oncreateview(). this codes view part public class mainmenu extends fragment { textview txt = null; view view1; view mview; public view oncreateview(layoutinflater inflater,viewgroup container, bundle savedinstancestate) { // view1 = inflater.inflate(r.layout.fragment_main_menu, container, false); mview = layoutinflater.from(getactivity()).inflate(r.layout.fragment_main_menu, null,false); pref = getactivity().getpreferences(0); twitter = new twitterfactory().getinstance(); twitter.setoauthconsumer(pref.getstring("consumer_key", ""), pref.getstring("consumer_secret", "")); txt = (textview)mview.findviewbyid(r.id.tww1); //run retrieve tweets method new tweetstream().execute(); new thread(new mainmenu().new consumer()).start(); return mview; } in fragment_main_menu.xml <linearlayout a

Reference to analyze the call dependencies in C/C++ -

i want analyze c/c++ files getting dependencies through source codes. data tells method in file call other function in other file. how can accomplish? if have reference, please share me. thanks. you can use different tool doxygen , kcachegrind, gprof, netbeans call graph analyzing dependencies. https://en.wikipedia.org/wiki/call_graph

How to access main.db of Skype App to display Recent Tab logs in Sample Android Application? -

i'm trying make android application in want show logs/call history of skype user(recent tab). as know, skype stores contacts in server , after logging in first time , syncs contacts using sync adapter in local storage i.e contacts db not sync logs. logs stored in /data/data/com.skype.raider/files/ user-name /main.db is there way can access db,so call history of current logged-in skype user can displayed in android app? , if there way access db, work on non-rooted phones also? the database file of app stored in data directory @ location "data/data/package_name/databases" , directory can not accessed if device not rooted. know in case of skype main.db file stored @ "/data/data/com.skype.raider/files/ user-name/main.db". the way access root device. steps after rooting device be, your app should root access superuser. locate , parse "shared.xml" file in "data/data/package_name/files/shared.xml". in xml file username usern

javascript - Simple js loop using null as a condition -

/i trying make simple loop. can't seem work. var c =0; while (x !== false) { x = men[c].plat; if (x == "null") {break;} f = f + x + "<br>"; c++; } var men = [ {"plat": 7}, {"plat": 1}, {"plat": null }]; i want loop see "null" string , leave loop. thanks assuming else fine, check should x === null since null keyword, not string. also, declaration of men needs before loop, or else that's not accessible. tip: huge favor , pick more descriptive variable names. rule of thumb never use 1-character variable names aren't loop counters.

python 3.x - My sqlite3 cursor has less rows than expected -

in following code have 2 cursors first loc_crs should have 3 rows in it. when run program loc_crs seems have 1 row import db_access def get_average_measurements_for_area(area_id): """ returns average value of measurements locations in given area. returns none if there no measurements. """ loc_crs = db_access.get_locations_for_area(area_id) avg = 0 loc_row in loc_crs: loc_id = int(loc_row['location_id']) meas_crs = db_access.get_measurements_for_location(loc_id) meas_row in meas_crs: meas = float(meas_row['value']) avg += meas # print("meas: ", str(meas)) print("loc_id: ", str(loc_id)) print(str(avg)) get_average_measurements_for_area(3) this output. loc_id: 16 avg: 568.2259127787871 edit: here methods being called: def get_locations_for_area(area_id): """ return list of dictionaries giving locations given area. """ cmd = 'sel

while(i--) loop in javascript -

i use while loop as: while (i<some_value) i saw while(i--) syntax , thought shorter , cooler , tried following in google-chrome. var num_arr= [4,8,7,1,3]; var length_of_num_arr=num_arr.length; while(length_of_num_arr--) console.log(num_arr); [4, 8, 7, 1, 3] [4, 8, 7, 1, 3] [4, 8, 7, 1, 3] [4, 8, 7, 1, 3] [4, 8, 7, 1, 3] **// expected result** but when try... while((num_arr.length)--) console.log(num_arr); [4, 8, 7, 1] [4, 8, 7] [4, 8] [4] [] // why happening?? is there hidden things need understand use syntax? arrays’ length property writable, , cut off elements or add empty slots appropriate when set it. var items = [1, 2, 3, 4, 5]; items.length = 3; // items [1, 2, 3] items.length = 6; // items sparse array: [1, 2, 3, undefined × 3] so, don’t that.

html - jQuery onclick toggle function -

i have following foundation toggle element: <div class="switch radius"> <input id="x" name="switch-x" type="radio" onclick="$(this).revealprofile('no');"checked> <label for="x">no</label> <input id="x1" name="switch-x" type="radio" onclick="$(this).revealprofile('yes');"> <label for="x1">yes</label> <span></span> </div> when clicked change input boolean value of hidden field true false: <input id="real_property_sale_reveal_owner_profile" name="real_property_sale[reveal_owner_profile]" type="hidden" value="false"> i've written following functions achieve this: $.fn.revealprofile = function(no) { $('input#real_property_sale_reveal_owner_profile').val('false'); }; $.fn.revealprofile = function(yes) { $('

Python encoding issue when trying to parse JSON tweets -

i trying parse out tweet , username sections of json object returned twitter using following code: class listener(streamlistener): def on_data(self, data): all_data = json.loads(data) tweet = all_data["text"] username = all_data["user"]["screen_name"] c.execute("insert tweets (tweet_time, username, tweet) values (%s,%s,%s)" , (time.time(), username, tweet)) print (username, tweet) return true def on_error(self, status): print (status) auth = oauthhandler(ckey, csecret) auth.set_access_token(atoken, asecret) twitterstream = stream(auth, listener()) twitterstream.filter(track = ["lebron james"]) but following error. how can code adjusted decode or encode response properly? traceback (most recent call last): file "c:/users/sagars/pycharmprojects/youtube nlp lessons/twitter stream db.py", line 45, in <module> twitte

Pyspark Array Key,Value -

i have rdd array stores key-value pair key 2d indices of array , value number @ spot. example [((0,0),1),((0,1),2),((1,0),3),((1,1),4)] want add values of each key surrounding values. in relation earlier example, want add 1,2,3 , place in (0,0) key value spot. how this? i suggest following: define function that, given pair (i,j), returns list pairs corresponding positions surrounding (i,j), plus input pair (i,j). instance, lets function called surrounding_pairs(pair) . then: surrounding_pairs((0,0)) = [ (0,0), (0,1), (1,0) ] surrounding_pairs((2,3)) = [ (2,3), (2,2), (2,4), (1,3), (3,3) ] of course, need careful , return valid positions. use flatmap on rdd follows: myrdd = myrdd.flatmap(lambda (pos, v): [(p, v) p in surrounding_pairs(pos)]) this map rdd [((0,0),1),((0,1),2),((1,0),3),((1,1),4)] [((0,0),1),((0,1),1),((1,0),1), ((0,1),2),((0,0),2),((1,1),2), ((1,0),3),((0,0),3),((1,1),3), ((1,1),4),((1,0),4),((0,1),4)] this way, value @ each position &qu

computation theory - Is there an algorithm for a compiler compiler that generates a recursive descent parser? -

i have written lr(1) compiler compiler , me table generation pretty straight forward. today found myself wondering if there general algorithm generating recursive decent parser. know there tools such javacc i'm more interested in general steps of generation. in advance.

c# - How do I test for HTTP method in a GraphEngine server endpoint? -

the graphengine docs http protocols restful. trying implement such, can't find information testing http method being used call endpoint. to understanding, essential restful, right? methods get, post, put , delete map crud-like select, update, insert , delete operations. i have looked @ sample applications, , have non-restful-sounding names, posttweet or searchtweet. leads me wonder, have authors of graphengine missed heart of rest , simplified mean rpc via http? or, there way handle different http methods in handler? i able question answered sending graphengine support email address. response: you right, tsl http protocols 'rpc on http'. ok call these protocols via http get/post. however, other http verbs (e.g. delete) not supported.

encryption - How to use AES CBC using a key longer than 256 bits in Python -

anyone have way encrypt/decrypt using python handle aes in cbc mode key of 1024 bits (128 bytes)? aes pkgs found far seem limited 256 bit keys. crypto background limited.... aes defined key sizes of 128, 192 , 256 bit. no way use other key size , still call aes. if want compatible other implementations, have stick defined key sizes. two common ways key of correct size are: simply slice part of key off toatch 1 of valid sizes. should done if big key created entropy. if not might make brute forcing easier. run big key through hash function such sha-256 256 bit key. again, if big key has low entropy should regard long password , run example through pbkdf2 many iterations.

oracle - Invoke SQL file which invokes multiple SQL files -

environment: database oracle 11g windows 2008 r2 i have batch program creates sql file (oracle) invokes other sql files for example generated sql file batch script called generatedfile.sql spool <somelogdir/logfile.log> prompt execute abc.sql @ <\path\to\abc.sql\>abc.sql prompt execute xyz.sql @ <\path\ to\ xyz.sql\>xyz.sql etc. spool off exit; i invoking sql file using sqlplus -s <someusername>/password@hostname:1521/some_sid @generatedfile.sql sql file sits , spins without doing anything. spool generated empty. i assume statement in \path\to\abc.sql not terminated ; or / .

class - C++ call a child's method from a vector of parents? -

say have following class: class parent { // methods , members go here }; then create child based on parent: class child : public parent { public: somefunction(); }; now class parent doesn't have somefunction() class child does. have vector of parent classes, , want call child's method, assuming vector holds instances of parents , children, given they're both same base type. std::vector<parent> mycontainer; mycontainer.push_back(a parent); mycontainer.push_back(a child); mycontainer[1].somefunction(); how can make work? i'm trying create vector of parents, children go in vector. want call method that's exclusive children. possible? you create vector of parent objects. there's no polymorphism here. vectors contain values. if want polymorphic container, have use else. it's if did parent myobject; no matter myobject later, still parent . if myobject = child() .

ruby on rails - How to get if or unless statement to work over multiple lines in erb template -

i'm trying write in logic erb template in chef cookbook. have following, thought work. @ moment attribute there nil, it's not skipping whole block thought would. how top statement cause template reader skip whole block? <% unless node['base']['logstash-forwarder']['nginx'].nil? %> <%= "{" %> <%= "\"paths\": [" %> <% node['base']['logstash-forwarder']['nginx'].each |path| %> <% unless path.equal? node['base']['logstash-forwarder']['nginx'].last %> <%= "\"#{path}\"," %> <% end %> <% end %> <%= "\"#{node['base']['logstash-forwarder']['nginx'].last}\"" %> <%= " ]," %> <%= "\"fields\": { \"type\": \"nginx-access\" }" %> <%= "

Scala -- mutually exclusive traits -

is there way define collection of alternatives of common type: trait mutability trait mutable extends mutability trait immutable extends mutability and have compiler preclude like: object hat extends mutable immutable i believe can force some compiler error having common, conflicting member error message bit oblique: trait mutability trait mutable extends mutability { protected val conflict = true } trait immutable extends mutability { protected val conflict = true } object hat extends mutable immutable <console>:10: error: object hat inherits conflicting members: value conflict in class immutable$class of type boolean , value conflict in class mutable$class of type boolean (note: can resolved declaring override in object hat.) object hat extends immutable mutable is there more direct way express constraint , not permit work around taking hint offered compiler (override 'conflict' in hat)? thanks insights i think might work sealed trait

javascript - Passing $index and $data as arguments to function for click handler -

i passing $index , $data change_model function. function expecting 2 parameters in following order: (index, data) . from viewmodel passing click: $root.change_model.bind($data, $index()) . within function index prints $data , , data prints index : values reversed. self.change_model = function(index, data) { self.patternselectedindex(index); selected_door = data.file; create_door(); }; <div data-bind="foreach: x.patterns"> <div class="thumbnail" data-bind="css: { selected: $index() === $root.patternselectedindex() }"> <img class='img model' style='width:164px;height:90px;padding:5px' data-bind="attr:{src:'images/models/' + $data.file + '.png'}, click: $root.change_model.bind($data, $index())" /> <div class="caption"> <span data-bind="text: $data.name"></span> </div> </div> </div>

Search for (LaTeX) regex found NOT within another regex (math mode) -

i'm trying find improperly-written commands in latex not within math mode. is, in following, want match "\bad" not "\good\" or "\math". example of \bad command. example of \good\ command. , $x=\math + y$ command. i figured out how match math mode, begins , ends non-escaped dollar signs "$" -- want invert match somehow: (?<!\\)\$.+?[^\\]\$ and figured out how match "\bad" not "\good\" (note space after +): \\[a-za-z]+ but can't figure out how combine two. i've tried (negative) lookarounds , don't seem getting anywhere (not every paragraph contains math mode). suggestions/hints? in advance! edit: i'm using perl-compatible regex (sublime text 3, exact). a "bad" command macro not within math mode, followed space. "good" command macro followed else -- punctuation or backslash -- or macro within math mode. sublime text uses boost library handle regexes, it&#

ruby on rails - Simple Spec That Validates_Associated -

i trying test validation on campaign model. have form allows user create campaign should require choose program before can save it. i tried following along few answers here on couldn't them work. here's have far.. the relationship.. class campaign < activerecord::base belongs_to :program validates_associated :program, message: "you need choose program." end class program < activerecord::base has_many :campaigns end ..and spec. it 'validates associated campaign' campaign = build(:campaign) expect(campaign.save).to false expect(campaign.errors).to eq "you need choose program." end the failure.. failures: 1) campaign validates associated campaign failure/error: expect(campaign.save).to false expected false got true # ./spec/models/campaign_spec.rb:34:in `block (2 levels) in <top (required)>' validates_associated works when associated object presen

How to read a comma as a flag for next variable in C? -

the input file have name of lake on 1 line, comma, volume of lake in units of hundreds of cubic miles. next line contain name of lake, comma, it's volume, etc, etc. each line of file contains name of lake, comma, , float value volume.the name of lake may contain more 1 word; example "dead horse lake", on 1 formatted line. volume may have decimals in it, 16.9. program use subroutine takes arguments name of lake , volume. subroutine print out name of lake on 1 line screen, followed set of consecutive asterisks denoting volume in units of hundreds of cubic miles on next line rounded nearest hundred cubic miles. example, if lake 15.6 cubic miles in volume, subroutine print out 16 asterisks on line following name of lake. right program reads first line , displays name , asterisk, other information in lakes.txt file not read , program terminates. please tell me doing wrong? original project 1 without comma, prof. decided add comma in there. changed %19 %20 , added comma i

python - Pandas select and write rows that contain certain text -

i want keep rows in dataframe contains specific text in column "col" . in example either "word1" or "word2" . df = df["col"].str.contains("word1|word2") df.to_csv("write.csv") this returns true or false . how make write entire rows match these critera, not present boolean? what returned boolean series use filter df: df = df[df["col"].str.contains("word1|word2")] you can write out normal: df.to_csv("write.csv") example: in [14]: df = pd.dataframe({'col':['word', 'word1', 'word2', 'word3']}) df out[14]: col 0 word 1 word1 2 word2 3 word3 in [15]: df[df['col'].str.contains('word1|word2')] out[15]: col 1 word1 2 word2

javascript - Align H2 vertically, inside of the dynamically sized DIV -

i need aligning h2 inside of masonryjs blocks - vertically , horizontally, each block has dynamic width/height, (whatever image size is). there hover state h2 tag. i have tried many different approaches, none seem work. any 1 has idea whats cleanest way around this? <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/masonry/3.3.0/masonry.pkgd.min.js"></script> <script type="text/javascript"> $(document).ready( function() { $('.grid').masonry({ itemselector: '.grid-item', columnwidth: 160 }); }); </script> <style type="text/css"> * { -webkit-box-sizing: border-box; box-sizing: border-box; } body { font-family: sans-serif; } /* ---- grid ---- */ .grid { background: #fff; width: 90%; max-width: 1200px; margin: 0 auto; } /* clearfix */ .grid:after { conte

z3 - z3py: How to improve the time efficiency of the following code -

this simplified code using similar implementation idea z3py code problem trying solve more complex , takes 1 minute run. the intuition of following code translate array of integers in inputarray array of months defined enumsort, infer model of montharray. from z3 import * s = solver() month,(jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec)=enumsort('month',['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec']) montharray = array('montharray',intsort(), month) inputarray = array('inputarray',intsort(),intsort()) temparray = array('temparray',intsort(),intsort()) intarray = [1,3,6,7,8,3,5,6,3,12,11,5,2,5,7,3,7,3,2,7,12,4,5,1,10,9] idx,num in enumerate(intarray): temparray = store(temparray,idx,num) s.add(inputarray==temparray) length = int('length') s.add(length == len(intarray)) = int('i') s.add(forall(i,impli

Group by index + column in pandas -

i have dataframe has columns user_id item_bought here user_id index of df. want group both user_id , item_bought , item wise count user. how do that. thanks this should work: >>> df = pd.dataframe(np.random.randint(0,5,(6, 2)), columns=['col1','col2']) >>> df['ind1'] = list('aaabcc') >>> df['ind2'] = range(6) >>> df.set_index(['ind1','ind2'], inplace=true) >>> df col1 col2 ind1 ind2 0 3 2 1 2 0 2 2 3 b 3 2 4 c 4 3 1 5 0 0 >>> df.groupby([df.index.get_level_values(0),'col1']).count() col2 ind1 col1 2 2 3 1 b 2 1 c 0 1 3 1 i had same problem using 1 of columns multiindex. multiindex, cannot use df.index.levels[0] since has distinct values particular index level

javascript - 2 different google charts on 1 html page (1 lineChart with JSON and 3xgauge hardcoded) -

<!doctype html> <html> <head> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <link rel="stylesheet" href="widget.css" type="text/css"> <script type="text/javascript"> google.load("visualization", "1", {packages:["gauge"]}); google.setonloadcallback(drawchart); function drawchart() { var data = google.visualization.arraytodatatable([ ['label', 'value'], ['temperatuur', 25], ]); var data2 = google.visualization.arraytodatatable([ ['label', 'value'], ['vochtigheid %', 40], ]); var data3 = google.visualization.arraytodatatable([ ['label', 'value'], ['windkracht', 3], ]); var options = {

objective c - Sharing Property information between classes in Obj C -

i've been trying share information 1 of classes 1 (trying out spritebuilder) , it's just. not. working. i want change text of label in second class string define in first. here code. mainscene.h @interface mainscene : ccnode @property cclabelttf *lblchange; -(void) _button; @end mainscene.m #import "mainscene.h" #import "storyscene.h" @implementation mainscene -(void)_button { startscene *starthold = [[startscene alloc] init]; [starthold.lbltwo setstring:@"hello world!"]; nslog(@"%@, storyscene", starthold); nslog(@"%@, main scene", @"yessss"); nsstring *filler = [starthold.lbltwo string]; nslog(@"%@",filler); ccscene *storyscene = [ccbreader loadasscene:(@"startscene")]; [[ccdirector shareddirector] replacescene: storyscene]; } @end storyscene.h #import "ccnode.h" @interface startscene : ccnode @property cclabelttf *lbltwo; @end sto

java - CXF security multiple keystore with WSS4JOutInterceptor -

i have question cxf security. trying implement webservice autentication in keystore in examples found in internet authentication see 1 one. i have project running in mode q specify single client since defini private key public key. if example need service connect 10 different clients, understand have create 10 private keys , 10 public keys. but set on application server? i leave lines below current settings have project. server_decrypt.properties org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.merlin org.apache.ws.security.crypto.merlin.keystore.type=jks org.apache.ws.security.crypto.merlin.keystore.password=storepassword org.apache.ws.security.crypto.merlin.keystore.alias=serverx509v1 org.apache.ws.security.crypto.merlin.file=server-keystore.jks server_sign.properties org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.merlin org.apache.ws.security.crypto.merlin.keystore.type=jks org.apache.ws.security.cry

docusignapi - DocuSign - Word/Pdf/Html file send -

i using .net integrate docusign have requirement take pdf/word/html file , send via docusign before add few fields document. believe adding fields should possibly have read unsure how send pdf / word / html file directly? please note, not using template stored in docusign , filling in fields. other question, if use template, see can attach other documents can merge template doc , doc uploading 1 or send 2 different files? thanks, alex yes want send signature request on document (as opposed on template) easy do, need make multipart/form-data post request. have gone through docusign developer center , subsequently api tools page? 1 of tools api walkthroughs , shows 9 of common api use cases, , you'll see 4th 1 (the middle left square) titled "request signature on document". that code walkthrough shows in 6 different languages how send signature request on local document- not sure stack you're using since didn't tag language. can copy sourc

c++ - Does const containers have only const iterator? -

why const stl containers return const_iterator s? for example both std::vector , std::list have method begin overloaded as: iterator begin(); const_iterator begin() const; const_iterator cbegin() const; i thought still modify values of const vector not vector itself. according standard library there no difference between: const std::vector<int> and const std::vector<const int> suppose have iterator begin() const; instead of const_iterator begin() const; now, think happens when have const vector<foo> v; you able like *v.begin() = other_foo; which of course shouldn't legal if want preserve logical const-ness. solution therefore make return type const_iterator whenever invoke iterators on const instances. the situation similar having const classes have pointer members. in cases, may modify data pointer points (but not pointer itself), logical const-ness not preserved. standard library took step forward , disallowed th

javascript - Using a authentication login a parameter in request header in frisby -

i'm trying test requires authentication token login using frisby, the problem is : response of request string , not json , still havent figured out how working. i've read few examples found googling havent been helpful far. here's code: var frisby= require('frisby'); frisby.create('login') .post('http://mid.dev.psafe.com/my.api/security/authentication.svc/login', {"user":"115303640577606155760"}, {json:true}, { headers: { 'content-type': 'application/json' }}) .expectstatus(200) .afterjson(function (token) { frisby.globalsetup({ request: { headers: { 'user-token': token } } }); frisby.create('list associated devices') .post('http://mid.dev.psafe.com/my.api/apiadmin.svc/getdevices', {json:true}) .expectstatus(200) .toss(); }) .tos

How do I get custom claims in the JWT produced by WSO2 API Manager -

i want include of claims in our secondary user store jwt generate apim. using implicit authentication our current task, user have authenticate is. using federated authentication jit provisioning. i have enabled: <claimsretrieverimplclass>org.wso2.carbon.apimgt.impl.token.defaultclaimsretriever</claimsretrieverimplclass> and set: <consumerdialecturi>http://wso2.org/claims</consumerdialecturi> and enabled: <enabletokengeneration>true</enabletokengeneration> but jwt generated not include user's data, standard gateway claims, including enduser. i have confirmed user created in db , user's claims in stored in table um_user_attribute. did notice in primary user store (not federated) um_user_attribute empty , um_claim populated. jit provisioning putting data in table not checked claimsmanager? how user's claims (like email) show in jwt? is 5.0.0 apim 1.8.0 for interested, here 2 leads have put me on path solvi

android - Raising alerts from backend javascript -

i'm building app meteor , meteoric (integration ionic, replaces angular blaze). have method running on server want popup alert user if condition met, of course can't because ionic client side framework. i tried return variable place in client call method , make raise popup ignores it. (maybe because can't between client , server?) anyone has suggestion this? you make request client server, , depending on response on client can alert (or continue if example nothing went wrong). did try already? , method doing?

c# - MS SQL how to record negative time -

i have column in ms sql database type “time”. need record negative value in it. isn't range between 2 times or dates. it’s abstract value of time used in calculations. in entity framework treated timespan, metadata.tt automatically time defined columns in database. for example, might have arbitrary calendar events @ 5am , 8pm on monday, 1 @ 4pm on tuesday, , 1 @ 3am on sunday after that. add value these times , time either before (in case of negative time), or after (in case of positive time) beginning of event. when try write down negative value, database refuses it. the recording of entity database goes direct bind of post attributes in controller, if needs translated ticks, reliable in javascript? how go input textbox it? looks cannot separate value content in text box. , if have turn int, cannot use @editorfor on anymore, creating point of fault code becomes less flexible. it feels should create new columns denote negativity of these values , use dropdown list hidde

apache - PHP: How to read POST body with Transfer-Encoding: chunked, no Content-Length -

i writing service receive data energy monitoring device in house. way device can push data using http post , transfer-encoding: chunked , , no content-length , , data xml in request body. i able read data in php script (behind apache) , store in database. it appears correct way read http request body in php these days open , read php://input . however, comments users on php's website indicate (and testing confirms), if no content-length header specified client, php://input returns no data (even if there data being sent client in chunked encoding). is there alternate way access request body? can configure apache (with .htaccess) decode chunked data , call script once gets all, , include content-length ? or configure php able handle this? thanks! might write answer suppose. the issue describe documented here: https://bugs.php.net/bug.php?id=60826 highlights thread: so here found. if send chunked http request not send content-length (as should using h

Is it possible for a Chrome extension to access an IndexedDB database created by a specific domain? -

if http://example.com/ creates indexeddb database, possible chrome extension (used on domains other example.com ) open , query database? no, can not it. data storage sandboxed http://www.html5rocks.com/en/tutorials/offline/storage/

c++ - Virtual function implemented as template in derived class -

having following code: struct base { virtual void print(int x) = 0; virtual void print(float x) = 0; }; struct derived : public base { template<typename t> void print(t x) { std::cout<<x<<std::endl; } }; is possible c++ black magic(explicit instantiation types, smart using , etc) recognize implementation of: virtual void print(int x) = 0; virtual void print(float x) = 0; in derived class in form of: template<typename t> void print(t x) no, there isn't. what can forward local template implementation: struct derived : public base { void print(int x) override { printtempl(x); } void print(float x) override { printtempl(x); } template <typename t> void printtempl(t x) { std::cout << x << std::endl; } }; if find verbose, , have many such print s, can macro it: #define print_fwd(typ) void print(typ x) override { printtempl(x); }

java - spring security filter chain patterns -

when using spring security map chain of filters url patters specify how urls secured. these patterns can contain wildcards such as /foo/*/bar /foo/**/bar i couldn't find docs these wildcards, guess first pattern match /foo/baz/bar but not /foo/baz/baz/bar whereas second pattern ( /foo/**/bar ) match both of these maybe code help: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:security="http://www.springframework.org/schema/security" xmlns:p="http://www.springframework.org/schema/p" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/security http://www.springframework.org/s

bash - Linux for loop for 2 inputs and 4 outputs -

Image
i need write for loop. input: file01_r1.fastq, file01_r2.fastq. have 100 files e.g., file02_r1.fastq, file02_r2.fastq , on. output: file01_r1_pe.fastq, file01_r1_se.fastq, file01_r2_pe.fastq, file01_r2_se.fastq i need write loop can run executable 100 files. please! i assume given file file01_r1.fastq you want run: trimmomatic file01_r1.fastq file01_r2.fastq -o file01_r1_pe.fastq file01_r1_se.fastq file01_r2_pe.fastq file01_r2_se.fastq using gnu parallel looks this: parallel trimmomatic {} {= s/_r1/_r2/ =} -o {= s/_r1/_r1_pe/ =} {= s/_r1/_r1_se/ =} {= s/_r1/_r2_pe/ =} {= s/_r1/_r2_se/ =} ::: *_r1.fastq gnu parallel general parallelizer , makes easy run jobs in parallel on same machine or on multiple machines have ssh access to. if have 32 different jobs want run on 4 cpus, straight forward way parallelize run 8 jobs on each cpu: gnu parallel instead spawns new process when 1 finishes - keeping cpus active , saving time: installation if gnu

Is there a way to render the page my script is on when I manually cancel the script in phantomjs? -

so title says, there way render png of page script on if error codes causes code run infinite loop when manually stop code in terminal ctrl+c in phantomjs? no, don't have control on phantomjs process. event handler looks promising phantom.onerror , doesn't work (i tried it).

c++ - pointer to member function of incomplete type -

i don't understand why adding forward declaration class changes size of pointer member type #include <iostream> using namespace std; int main() { //struct cl; //cout<<sizeof(int (cl::*)())<<endl; struct cl{}; cout<<sizeof(int (cl::*)())<<endl; } output vs2013: 4 but if uncomment first 2 lines in main(), output different: 16 16 so, simple adding forward declaration before definition of struct cl increases size of pointer member of cl. why? know size of member function pointer depends structure of type (e.g. virtual functions , base classes may increase it), why can sizeof operator applied pointer member of incomplete type? or can't? have not found in standard the msvc compiler uses different sizes pointers member functions optimization. optimization violates standard. kudos igor tandetnik mentioning reinterpret_cast in a msdn form post , [expr.reinterpret.cast]p10 a prvalue of type “pointer member of

http - haproxy streaming response code 400 -

i have rest api sitting on openshift behind haproxy returns response code 400 if user doesn't enter required parameter. result haproxy doesn't work @ , throws following error: server express/local-gear down, reason: layer7 wrong status, code: 400, info: "http status check returned code <3c>400<3e>", check duration: 1ms. 0 active , 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue. returning response code 200 error works fine feels wrong... is there way achieve sending 400 response through haproxy? or check? the message appears haproxy health check failing. believe either have add special handler url haproxy health check request pinging returns 200, or if url serves different purpose, change haproxy configuration use different url returns 200. discussion see: https://forums.openshift.com/war-deployment-behind-haproxy http://codereply.com/answer/7v36m9/nodejs-app-openshift-accessible-rhcloudcom-application-url

Drupal 8 Admin Primary Tabs Completely Disappeared -

Image
i'm building site in drupal 8, , pushed code local our development box, , on development box, admin primary tabs have disappeared. everywhere. following screenshot of issue. the code version controlled (git), , databases identical. there no outstanding configuration changes synchronize either. i'm pulling hair out trying figure out issue is. there settings somewhere i'm missing? i've tried logging out, clearing cache, different browser. nothing. wanted second option before submitting issue report on drupal.org. i don't know why configuration identical when shouldn't, think admin theme not have "primary tabs" blocks in header, can check production env block layout , see if infact "primary tabs" block there (admin/structure/block/list/seven).

Problematic combination of variance in Scala -

here example scala course on coursera: , lecture 4.4 class array[+t] { def update(x: t) = ??? } this causes error in repl: error: covariant type t occurs in contravariant position in type t of value x and on slides, martin says "problematic combination". why so? this explained in "variance , arrays" section of http://www.artima.com/pins1ed/type-parameterization.html (from programming in scala odersky, venners, , spoon).

apache - Error wsgi in server installed in MAC Yosemite -

Image
i have problems wsgi module , not understand why. installed apache, remove mamp because gave me many problems. have configured port , page loads fine. install mysql load script , well. install python-mysql connector , make connection , connects. when access site , want register strip mistake, nose if reaches database or not. me understand happens. attached codes. httpd.conf serverroot "/usr/local/apache2" listen 8080 loadmodule authn_file_module modules/mod_authn_file.so loadmodule authn_core_module modules/mod_authn_core.so loadmodule authz_host_module modules/mod_authz_host.so loadmodule authz_groupfile_module modules/mod_authz_groupfile.so loadmodule authz_user_module modules/mod_authz_user.so loadmodule authz_core_module modules/mod_authz_core.so loadmodule access_compat_module modules/mod_access_compat.so loadmodule auth_basic_module modules/mod_auth_basic.so loadmodule socache_shmcb_module modules/mod_socache_shmcb.so loadmodule reqtimeout_module modules/mod