Posts

Showing posts from June, 2013

while loop - java 1.7 - how to read same data on different position using same code/method -

i have while operator reading data, int typearr =0 ; int newobj = 0; int name = 0; while((name =readint()) != 0x00) { int info = in.readunsignedbyte(); int type = in.readunsignedbyte(); if(propertysizetype == 1) { typearr = in.readunsignedbyte(); (int k = 0; k < typearr; k++) { newobj = in.readunsignedbyte(); } } } problem after readed newobj value, need move position - that in.seek(newobj); after need repeat same process did in above(while ...) how can ? use function javadoc while((name =readint()) != 0x00) { try{ int info = in.readunsignedbyte(); int type = in.readunsignedbyte(); if(propertysizetype == 1) { typearr = in.readunsignedbyte(); (int k = 0; k < typearr; k++) { newobj = in.readunsignedbyte(); in.seek(newobj); // newobj should long } } }catch(exception e) { e.printstacktrace(); break; } }

android - Is it possible to do a repeated task even if app is killed from Task Manager? -

i've created alarmmanager call broadcastreceiver make request server every interval seconds. alarmmanager alarmmanager = (alarmmanager) getsystemservice(context.alarm_service); pendingintent intent = pendingintent.getbroadcast(this, 0, new intent(this, sendlogreceiver.class), 0); alarmmanager.setinexactrepeating(alarmmanager.rtc_wakeup, system.currenttimemillis(), 1000, intent); and broadcastreceiver: public class sendlogreceiver extends broadcastreceiver { private static final string tag = sendpositionreceiver.class.getsimplename(); @override public void onreceive(context context, intent intent) { log.d(tag, "sending position server"); } } it works when app in background, when close app though task manager (by swiping) alarmmanager dies , no more signals received. is there way achieve broadcastreceiver continue working whenever apps killed? thanks i not know "task manager" referring to. the standard android re...

java - declaring a variable textfield -

i trying declare jtextfield variable name for fixed jtextfield declare after public class as private jtextfield hh1; but variable text field trying create them within int count = 1 hh + count++ = new jtextfield(10); this within private class private void creategui() { setdefaultcloseoperation(exit_on_close); container window = getcontentpane(); window.setlayout(new gridbaglayout()); gridbagconstraints gbc = new gridbagconstraints(); gridbagconstraints gbc1 = new gridbagconstraints(); gbc.fill = gridbagconstraints.both; gbc.insets = new insets(5, 50, 5, 0); gbc1.insets = new insets(5, -100, 5, 10); int count = 1; for(int y = 0; y < 10; y++) { gbc.gridy = y; gbc1.gridy = y; for(int x = 0; x < 1; x++) { gbc.gridx = x; gbc1.gridx = x; vol1hh + count++ = new jtextfield(10); hh1 = new jlabel("hh1"); window.add(hh1 + count++, gbc1); window.add(vol1hh + count++, gbc); } how can create variable jtextfields called hh1 hh10? answer below private jtextfi...

lotus notes - How to set default values for a LotusScript PickListString using Names -

i have following code on button on notes form sub click(source button) dim ws new notesuiworkspace dim rtn variant dim thisdoc notesdocument dim orignames variant set thisdoc = ws.currentdocument.document orignames = thisdoc.ccto rtn = ws.pickliststrings( picklist_names,true ) if not(isempty( rtn)) thisdoc.ccto = rtn thisdoc.cctochanged = 1 end if ws.currentdocument.refresh end sub the picklist works fine , sets values field ccto however, need have values in orignames set of default values in picklist , can't see how there. the pickliststring not utilize pre selected choices. think should use notesuiworkspace.prompt( ) the type prompt_okcancellistmult precise. notes designer has example code.

iprincipal - Why to create a custom principal interface when you want to create a Custom Principal in Asp.net MVC? -

recently seaerched how create custom principal , got answer there 1 thing not understand, found solution on stack overflow using system; using system.collections.generic; using system.linq; using system.web; using system.security.principal; namespace workflow.authorize { interface icustomprincipal : iprincipal { int id { get; set; } string firstname { get; set; } string lastname { get; set; } } public class customprincipal : icustomprincipal { public iidentity identity { get; private set; } public bool isinrole(string role) { if(this.roles.contains(role)) return true; else return false; } public customprincipal(string email) { this.identity = new genericidentity(email); } public int id { get; set; } public string firstname { get; set; } public string lastname { get; set; } public string r...

pandas - AttributeError: 'DataFrame' object has no attribute 'colmap' in Python -

i python beginner , try use following code source: portfolio rebalancing bandwidth method in python the code works far. the problem if want call function not usual rebalance(df, tol) , location in dataframe on, like: rebalance(df[500:], tol) , following error: attributeerror: 'dataframe' object has no attribute 'colmap' . question is: how have adjust code in order make possible? here code: import datetime dt import numpy np import pandas pd import pandas.io.data pid def setup_df(): df1 = pid.get_data_yahoo("ibm", start=dt.datetime(1970, 1, 1), end=dt.datetime.today()) df1.rename(columns={'adj close': 'ibm'}, inplace=true) df2 = pid.get_data_yahoo("f", start=dt.datetime(1970, 1, 1), end=dt.datetime.today()) df2.rename(columns={'adj close': 'ford'}, inplace=true) d...

r - Matching patterns in a matrix -

my data looks this: s 0101001010000000000000000100111100000000000011101100010101010 1001010000000001100000000100000000000100000010101110101010010 1101010101010010000000000100000000100101010010110101010101011 0000000000000000001000000111000110000000000000000000000000000 the s indicates column talking. col 26. 4 rows share 1 @ position. i need able count each row 2 4: how many columns left , right same row 1? for row 2 3 right (as reaches 1/0) , 8 left (as reaches 0/1). the result every row should entered matrix this: row2 8 3 row3 11 9 is there fast , efficient way that? matrix dealing large. if need fast, use rcpp: mat <- as.matrix(read.fwf(textconnection("0101001010000000000000000100111100000000000011101100010101010 1001010000000001100000000100000000000100000010101110101010010 1101010101010010000000000100000000100101010010110101010101011 0000000000000000001000000111000110000000000000000000000000000"), widths = re...

How do I use custom stopwords and stemmer file in WEKA (Java)? -

so far have: ngramtokenizer tokenizer = new ngramtokenizer(); tokenizer.setngramminsize(2); tokenizer.setngrammaxsize(2); tokenizer.setdelimiters("[\\w+\\d+]"); stringtowordvector filter = new stringtowordvector(); // customize filter here instances data = filter.usefilter(input, filter); the api has these 2 methods stringtowordvector: setstemmer(stemmer value); setstopwordshandler(stopwordshandler value); i have text file containing stopwords , class stems words. how use custom stemmer , stopwords filter? note i'm taking phrases of size 2, can't preprocess , remove stopwords beforehand. update: worked me (using weka developer version 3.7.12) to use custom stopwords handler: public class mystopwordshandler implements stopwordshandler { private hashset<string> mystopwords; public mystopwordshandler() { //load in own stopwords, etc. } //must implement method stopwordshandler interface public boolean isstopword(st...

C - multiple definition of function during building large project -

i'm trying build large project , in have following header file error.h #ifndef __error_h__ #define __error_h__ #include <stdio.h> #include <stdlib.h> void error_validate_pointer(void *ptr) { if (ptr == null) { puts("error allocating memory"); exit(1); } } #endif /* __error_h__ */ i use function in every .c file have (i include "error.h" in every file) thought #ifndef protect me multiple definition error. yet, during building, following errors: ../dictionary/libdictionary.a(state_list.c.o): in function `error_validate_pointer': /home/pgolinski/dokumenty/programowanie/spellcheck-pg359186/src/dictionary/error.h:8: multiple definition of `error_validate_pointer' ../dictionary/libdictionary.a(hint.c.o):/home/pgolinski/dokumenty/programowanie/spellcheck-pg359186/src/dictionary/error.h:8: first defined here ../dictionary/libdictionary.a(state_set.c.o): in function `error_validate_pointer': /home/pgolins...

ruby - Rails: Model method doesn't execute as a cron task in development -

i writing application in ruby on rails fetches data (videoid string, title string, thumbnail url string, , date of when video created datetime type) youtube , saves database. i have tested youtube api in pure ruby before , know output should correct, should return data mentioned previously. however, can't seem make work in rails cron job using whenever gem. below have 2 methods interact model. 1 of them works , other 1 doesn't. 1 doesn't self.create_youtube_posts , 1 test method created check whether gets executed cron job using whenever gem ( self.create_test_posts ). problem me don't see error messages first one, code doesn't execute. if explain me why 1 method work , other doesn't, or nudge me in right direction, appreciated. please note not question asking on youtube api, rather ruby code. app/models/post.rb class post < activerecord::base # method not working! def self.create_youtube_posts require 'faraday' ...

Copy excel data in table format and paste in outlook as table -

i have data in excel sheet, row headers , respective values in columns. want copied in tabular format , pasted in body of outlook email along few texts. unable find tabular code vba. suggest here snippet: stremailsubject = "" stremailtext = "" strcc = "" strcontactemail = "" olnewemail .to = strcontactemail '.cc = strcc .body = stremailtext .subject = stremailsubject .display end the outlook object model provides 3 main ways working item bodies: body - string representing clear-text body of outlook item. htmlbody - string representing html body of specified item. word editor - microsoft word document object model of message being displayed. wordeditor property of inspector class returns instance of document class word object model can use set message body. you can read more these ways in chapter 17: working item bodies . way choose customize message body. last 2 ways allows create table. note, may consider usin...

visual studio 2013 - Displaying the ASCII characters in C without unsigned char -

unsigned char a; for(a=32;a<128;a=a+1) printf("%d='%c'\t",a,a); return(0); why have put unsigned char? when left char, executed program , giving me infinite loop. shouldn't stop when a=127? char means either signed or unsigned depends on implementation. makes behaviour of code implementation defined . seems on machine signed . minimum , maximum value of signed char -127 & +127 respectively per c standard. value greater 127 or less -127 can't assigned a otherwise invoke undefined behaviour . after a reaches 127 , incremented 1 , value becomes 128 can't hold signed char variable , hence code invokes undefined behaviour.

php - Assocative array loop only prints first 2 characters -

i trying access value associative array, loop printing first 2 characters first element. <?php $memserver = array( array("ipsssss" , "port") //i want print first element ); for($i = 0; $i< count($memserver); $i++) { for($j = 0; $j<count($memserver[$i]); $j++) { echo $memserver[$i][$j][0]; } } ?> first of all, not associative array. example of associative array array('key' => 'value') . the loop not printing the first 2 characters of first element; printing first character (i) of "ipsssss" , first character (p) of "port". you must rid of inner loop: for($i = 0; $i< count($memserver); $i++) { //for($j = 0; $j<count($memserver[$i]); $j++) //{ echo $memserver[$i][0]; //} } (or use foreach construction described john conde).

javascript - RemoveAttr doesn't remove disabled -

<input type="checkbox" name="checking">j'accepte les conditions <input type="submit" value="valider" id="valide" disabled/> <script> $(document).ready(function(){ if((input=$("input:checkbox[name=checking]").is(":checked"))){ $("#valide").prop('disabled',true); } }); </script> hi, want enable button (valide) when checked checkbox you must add listener check box call function every time when user check or uncheck try sloution :) <input type="checkbox" onclick="check()" name="checking">j'accepte les conditions <input type="submit" value="valider" id="valide" disabled/> function check(){ if($('input[name=checking]').is(":checked")){ $("#valide").prop('disabled...

css - Site Broke only in FireFox -

a friend of mine have problem website, fixed errors, nothing seems work. website broke in firefox , ie. can´t find error. knows better way check error might problem? link: http://www.mitografias.com.br/ it looks problem may caused incorrect markup. the random image have in header not formed properly. since not using html5 doctype need include <img/> closing tag. the correct markup needs have / this: <img src="random.php" height="200" />

css ruling doesn't overriden when using id selector -

i have sidebar on page i'm trying apply custom css to, reason ruling won't override old ones though it's cascaded correctly. idea why happening? i using normalize.css , don't think that's problem. i want change margins on #author-name , #author-bio . thanks help. /************************************************ searchbox ************************************************/ #articles-sidebar { margin: 0.5em 0; padding: 1em; } #articles-sidebar h2, #articles-sidebar p { margin: 0; padding: 0; } #articles-sidebar input { box-sizing: border-box; padding: 0.5em; margin: 0.5em 0; } #articles-sidebar input[type="submit"] { border: none; color: #fff; background-color: #26a65b; } /************************************************ articles ************************************************/ .article-box { padding: 0.5em; margin-bottom: 0.5em; } .free { background-color: #e3f9ec; } .members { background-...

Ruby - gem install escape_utils fails with erorrs? -

when tried install gem install escape_utils -v '0.3.2' it gives me following errors dont know how fix using ruby --version ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux] rails -v not find escape_utils-0.3.2 in of sources run `bundle install` install missing gems. the error when trying install gem install escape_utils -v '0.3.2' building native extensions. take while... error: error installing escape_utils: error: failed build gem native extension. /usr/local/rvm/rubies/ruby-2.2.2/bin/ruby -r ./siteconf20150613-4082-zkyiyc.rb extconf.rb creating makefile make "destdir=" clean make "destdir=" compiling houdini_xml_e.c compiling buffer.c compiling escape_utils.c escape_utils.c: in function ‘rb_eu_escape_html_as_html_safe’: escape_utils.c:126: error: assignment of read-only member ‘klass’ make: *** [escape_utils.o] error 1 make failed, exit code 2 gem files remain installed in /usr/local/rvm/gems/ruby-2...

mysql - SQL: Changing structure of sql table with a million rows -

i have table(lets call mytable) below structure. table records close 1 million rows everyday. id date timestamp licenseid storeid deviceid value 1 2015-06-12 17:36:15 lic0001 1 0add -52 2 2015-06-12 17:36:15 lic0002 1 0add -54 3 2015-06-12 17:36:15 lic0003 1 0add -53 4 2015-06-12 17:36:21 lic0001 1 0add -54 5 2015-06-12 17:36:21 lic0002 1 0add -59 6 2015-06-12 17:36:21 lic0003 1 0add -62 7 2015-06-12 17:36:21 lic0004 1 0add -55 8 2015-06-12 17:36:15 lic0001 1 0bdd -53 9 2015-06-12 17:36:15 lic0002 1 0bdd -52 10 2015-06-12 17:36:15 lic0003 1 0bdd -52 11 2015-06-12 17:36:15 lic0004 1 0bdd -50 12 2015-06-12 17:36:33 lic0002 1 0bdd -54 13 2015-06-...

zend framework2 - integrate login to my sites with OpenId or OAuth -

i have few site developed zend framework 1 , zend framework 2,i wanna users register in main site , in other sites want have login button ,if user click on login: 1- if user logged in in main site ago , user login without enter information. 2- if user not logged in in main site popup open , ask username/password of main site ,then login site. don't understand possible openid or oauth. in openid user must generate openid id example: http://www.example.com/username but prefer user don't enter additional information. for example in stackoverflow can use google or yahoo account. if wanna use yahoo account asked openid,but don't know system google use not asked id , user enter email , password if not logged in google account, prefer google system user not enter url login. sincerely clicking google button on stackoverflow login screen secretly fills url https://www.google.com/accounts/o8/id as openid url. xrds file tells openid library auth server can f...

AngularJS - how to sync result of calculated input field to a scope variable -

i'm trying sync result of calculated form field scope variable. example: <div class="form-group"> <label for="val1" class="control-label">val 1</label> <input class="form-control" name="val1" type="number" ng-model="data.val1" id="val1"> </div> <div class="form-group"> <label for="val2" class="control-label">val 2</label> <input class="form-control" name="val2" type="number" ng-model="data.val2" id="val2"> </div> <div class="form-group"> <label for="score" class="control-label">score</label> <input class="form-control" name="score" value="{{data.val1+data.val2}}" type="text" id="score"> </div> <br/>data: {{data}} how can sync result...

osx - Python 2.7.9 Mac OS 10.10.3 Message "setCanCycle: is deprecated. Please use setCollectionBehavior instead" -

this first message , hope can me solve problem. when launch python script have message : 2015-06-10 23:15:44.146 python[1044:19431] setcancycle: deprecated.please use setcollectionbehavior instead 2015-06-10 23:15:44.155 python[1044:19431] setcancycle: deprecated.please use setcollectionbehavior instead below script : from tkinter import * root = tk() root.geometry("450x600+10+10") root.title("booleanv1.0") cadre_1 = frame(root, width=400, height=100) cadre_1.pack(side='top') filea = label(cadre_1, text="file a") filea.grid(row=0,column=0) enta = entry(cadre_1, width=40) enta.grid(row=0,column=1, pady=10) open_filea = button(cadre_1, text='select', width=10, height=1, command = root.destroy) open_filea.grid(row=0, column=2) fileb = label(cadre_1, text="file b") fileb.grid(row=1,column=0) entb = entry(cadre_1, width=40) entb.grid(row=1,column=1, pady=10) open_fileb = button(cadre_1, text='select',...

imagemagick - How to find the brightest pixel? -

how find brightness (i.e. v in hsv) of brightest pixel in image? i have large collection of images used background assets. in order make sure there no bright spots may distract viewer, i'd find images brightest pixels exceed threshold, can reworked. is there imagemagick operation doing this? hsv colorspace in im called hsb, can histogram of image.jpg in way: convert image.jpg -colorspace hsb -format %c histogram:info:- you need reverse sort output according third column (= brightness) , pick first line, can achieved (for following, assume linux os): convert image.jpg -colorspace hsb -format %c histogram:info:- \ | sort -t',' -gr -k 3 | head -1 next step filter brightness value itself. let's use sed , aware of alpha-channel: sed 's/.* hsb.*,.*,\([0-9.]*\)%.*/\1/' (this takes third number out of hsb- or hsba-parenthesis, percentage value of brightness of brightest pixel.) taking together, can write small script bchecker.sh examine...

javascript - If section has class than start playing video -

please me make video play automatically when @ moment of scrolling on #video-section appeared .visible class name․ , vice versa, when .visible class name removed section, video stoped. thanks. <section class="cd-section"> content </section> <section id="video-section" class="cd-section"> <video> <source src="http://www.w3schools.com/tags/movie.mp4" type="video/mp4"> </video> </section> <section class="cd-section"> content </section> jsfiddle here https://jsfiddle.net/y896ec5x/ what you're doing (based on comments): $("video").play(); // or $("video").pause(); is invalid, jquery doesn't have these functions natively. try using $.get method, returns regular javascript dom object of element: $("video").get(0).play(); // or $("video").get(0).pause(); then detect @ scro...

Storing the last input text whilst using the POST method with PHP -

the idea: i have been trying create one-way chat system based on predictions user, using pre-set automatic responses through server side. the problem: what have far works great, although problem have can't store last user inputted message locally chat flow in messages without using lots of _get 's. with current code: if (isset($_post['test'])) { $test = htmlentities($_post['test']); echo "<span class='you'>".$name."</span>: ".$test; if (preg_match('~\b(?:about)\b~', $test)) { echo '<br />'.$about; } else if (preg_match('~\b(?:projects?|works?)\b~i', $test)) { echo '<br />'.$projects; } else if (preg_match('~\b(?:contact|email|inquiry)\b~', $test)) { echo '<br />'.$contact; } else { echo "<br />error!"; } } for example, if user types projects input, $projects echo...

javascript - Allow typeahead,js to autocomplete words in text, instead of just single values in dropdown -

i want use typeahead.js auto-complete words in textarea. textarea write text. have source of words, should used typeahead suggest user on every entry of new word. i tried current value , destroy typeahead , reinitialize , set previous value, did not work, seems not correct way. please me find solution on this. i found http://yuku-t.com/jquery-textcomplete/ looking for.

javascript - Node.js, MongDB (Mongoose) - Adding to data retrieved. -

i have following code: user.find({ featuredmerchant: true }) .lean() .limit(2) .exec(function(err, users) { if (err) { console.log(err); return res.status(400).send({ message: errorhandler.geterrormessage(err) }); } else { _.foreach(users, function(user){ _.foreach(user.userlistings, function(listing){ listing.find({ user: user }).populate('listings', 'displayname merchantname userimagename hasuploadedimage').exec(function(err, listings){ user.listings = listings; }); }); }); res.jsonp(users); } }); as can see trying add retrieved listings each 'user' in 'users' lean object have returned. if console.log(user) inside listing.find exec method after adding 'user.listings = listings', result expect; user object listings property, listing property containing li...

inno setup - Creating new progress bar and customizing Installer page in innosetup -

i want create new progress bar , customize installer page bit. here want in installing page: a new progress bar show current file status(percentage complete). the default progress bar show overall progress(percentage complete) there 2 percentage complete label,one overall progress,another current file progress,they situated in top of each progress bar.

php - Having trouble acquiring the current posts title -

i working in wordpress , have link supposed play wav file depending on title of post. if post title 'one' should play one.wav uploads folder. however, sound file on every post plays current posts title. if added post called two , post called one , both posts play one.wav . here's code: html <span id="dummy"></span> <a class="playsound" onclick="playsound();" href="#"> <i class="fa fa-volume-up"></i> </a> jquery function playsound() { $.ajax({ url: 'sound.php', data: "getsound", type: "get", datatype: "html", success: function(data) { document.getelementbyid("dummy").innerhtml= "<embed src=\""+data+"\" hidden=\"true\" autostart=\"true\"loop=\"false\" />"; } ...

java - Junit test error No test found -

i used junit 3 , when wrote code got error assertionfailederror : no test found import junit.framework.testcase; import junit.runner.*; public class teststd extends testcase { student s; public void setup() { s = new student("asjfa"); } public void testemail() { try { s.setemail("kuku"); asserttrue(false); } catch (emailisinvalid ex) { asserttrue(true); system.out.println("exception caught. email invalid"); } } public void teardown() { } } your test method should start lowercase t . should public void testemail() . picked junit.

php - Symfony Functional Testing: how to understand why the test fails (with a 500 Error) -

i'm writing functional tests controller registers new user in app. the test i'm writing fails because of 500 http error. i'm using $response = $client->getresponse(); print_r($response->getcontent());exit; to print html see happening html incomplete in console (phpstorm) don't know happening , cannot find error solve it. any ideas how understand happening , causing error? may these can help: there test.log file in app/logs folder, can remove it, run tests, when error happens open newly generated file, read happend, that's it. or add debugbundle registerbundles method in appkernel.php file, , use dump() method, this: // appkernel.php if (in_array($this->getenvironment(), ['dev', 'test'])) { ... $bundles[] = new \symfony\bundle\debugbundle\debugbundle(); } ***** // usage: public function testsomeaction() { ..... $response = $client->getresponse(); dump($response); die; }

How to connect C# with node.js via socket.io -

i try connect c sharp application node.js using socketioclientdotnet doesn't work take @ codes using quobject.socketioclientdotnet.client; var socket = io.socket("http://localhost:7000"); socket.on(socket.event_connect, () => { socket.emit("hi"); }); socket.on("hi", (data) => { console.writeline(data); socket.disconnect(); }); console.readline() and error here e:\xamp\htdocs\connexion>node test_server_2.js info - socket.io started info - unhandled socket.io url i found! should upgrade socket.io 0.9.16 1.3.5 , works! all

Why passing parameter is OK between Vertex and Fragment shader -

a typical shader this: struct vin_vct { float4 vertex : position; float4 color : color; float2 texcoord : texcoord0; }; struct v2f_vct { float4 vertex : position; fixed4 color : color; float2 texcoord : texcoord0; }; v2f_vct vert_vct(vin_vct v) { v2f_vct o; o.vertex = mul(unity_matrix_mvp, v.vertex); o.color = v.color; o.texcoord = v.texcoord; return o; } fixed4 frag_mult(v2f_vct i) : color { fixed4 col = tex2d(_maintex, i.texcoord) * i.color; return col; } what i'm confused is: vert_vct called every vertex; frag_mult called every fragment (pixel in cases); so frag_mult run different times vert_vct, example, frag mult runs 10 times, , vert_vct runs 3 times triangle. every time frag_mult runs accept parameter passed vert_vct, ho...

php - codeigniter form_dropdown, set option value without an array -

Image
i want fetch table has 2 columns: id , name, , want column id value each option, , column name option name this controller //populate provinsi $this->load->model('provinsi'); $provinsi = $this->provinsi->get(); $this->load->view('admin/pages/product_form', array( 'provinces' => $provinsi, )); and in view <?php $options_provinsi = array('select_one' => 'select one'); foreach ($provinces $provinsi) { $options_provinsi[] = array( $provinsi->id => $provinsi->nama, ); } $extra = 'id="provinsi" class="form-control" onchange="loadlocation('provinsi','kota');"'; echo form_dropdown('provinsi', $options_provinsi, 'select_one', $extra); ?> code meet needs, because use array, dropdown become this: how set option value without...

python - DjangoSEO installation error - No module named hashcompat -

i want use djangoseo in project. i followed installation instructions provided in documentation : i ran pip install djangoseo , confirmed pip freeze added rollyourown.seo installed_apps setting added "django.core.context_processors.request" template_context_processors setting when try run python manage.py syncdb or run application following error d:\development\spellcheck\venv\lib\site-packages\django\contrib\sites\models.py:78: removedindjango19warning: model class django.contrib.sites.models.site doesn't declare explicit app_label , either isn't in application in installed_apps or else imported before application loaded. no longer supported in django 1.9. class site(models.model): traceback (most recent call last): file "d:/development/spellcheck/manage.py", line 10, in execute_from_command_line(sys.argv) file "d:\development\spellcheck\venv\lib\site-packages\django\core\management__init__.py...

mule - Error - Cannot apply transformer ObjectToHttpClientMethodRequest -

<flow name="initiateautobulkflow" doc:name="initiateautobulkflow"> <jms:inbound-endpoint queue="${queue.name}" connector-ref="active_mq" doc:name="jms message listener"/> <set-variable variablename="createlistings" value="#[new com.xyz.domain.inventory.v2.bulk.dto.bulklistingrequest()]" doc:name="new listings create"/> <choice doc:name="choice"> <when expression="ablinputmessage['oldfilepath'] == empty"> <component class="com.xyz.app.integration.autobulk.computefilediff" doc:name="java"/> <set-payload value="#[flowvars['createlistings']]" doc:name="set payload"/> <foreach collection="#[payload]" batchsize="2" doc:name="for each"> <logger message="#[payload]" level=...

Change default directory in Emacs startup in Linux(CentOS 7) -

i learning emacs nowadays. so, it's pretty frustrating find basic settings not directly accessible in menu bars. i searched changing default directory pops when use c-x c-f create/search file. find file: ~/cursor_blinking emacs version = gnu emacs 24.3 everywhere have suggested change default directory in ~/.emacs, or ~/.emacs.el, or ~/.emacs.d/init.el; whichever exists. in case, none of them exists. ~/.emacs.d directory exists,but there doesn't exist such file. i tried changing working directory using emacs command `cd', but, of no avail. also, similar questions have been asked here windows os, not case. how should work, given want set default-directory "my directory"? those 3 names possible names emacs configuration file. if none of exists, create 1 of them put configuration in it. the emacs command cd meant change default directory. can use interactively m-x cd , or call configuration file (cd "my directory") . in s...

javascript - WebChromeClient OnJSAlert is not called -

i'm running js script in webview. script alerts message webview, , want receive in app. problem onjsalert not called nor can use @override annotaion when definig method. imports - import android.webkit.webchromeclient; import android.webkit.webview; import android.webkit.webviewclient; import android.webkit.jsresult; import android.webkit.websettings; i use webview - webview = (webview)findviewbyid(r.id.webview1); webview.getsettings().setjavascriptenabled(true); webview.setwebchromeclient(new webchromeclient() { @override public void onprogresschanged(webview view, int newprogress) { if (newprogress == 100) { log.d("fibi", "finished loading"); } } //@override //if uncomment compilation error public boolean onjsalert(webview view, string url, string message, final jsresult result) { encresult = message; log.d("fibi", encresult); ...

How can I execute an external program with parameters in PowerShell? -

i have read answer stackoverflow answer , get's me there half way. here need do. execute command: "c:\myexe.exe <c:\users\me\myanswerfile.txt" if run straight within powershell script &'c:\myexe.exe <c:\users\me\myanswerfile.txt' i error: the term 'c:\myexe.exe <c:\users\me\myanswerfile.txt' not recognized name of cmdlet, function, script file, or operable program. check spelling of name,or if path included, verif path correct , try again. now have tried several variations of including placing original command in variable called $cmd , passing if append '<' $cmd variable command fails similar error first one. i'm stumped. suggestions? if want run program, type name , parameters: notepad.exe c:\devmy\hi.txt if want run exe , redirect stdin example seems attempt of, use: get-content c:devmy\hi.txt | yourexe.exe if need specify full path program need use ampersand , quotes otherwise powersh...

java - use message driven bean to get message from topic apache apollo -

i create java app uses message driven bean(mdb) message topic apache apollo through resource adapter activemq 5.10 in glassfish. when use apache activemq, works fine not work apache apollo. use mqtt send message topic , mqtt listen @ topic , gets message. when use mdb listen , can't message. see apollo console, tab virtual host -> topic. click topic use send , receive message. topic has consumer , producer, "enqueued: 2 items / 2.72 kb" consumer "transfers = 0". don't know how mdb work apollo. apollo.xml <broker xmlns="http://activemq.apache.org/schema/activemq/apollo"> <notes> default configuration tls/ssl enabled. </notes> <log_category console="console" `enter code here`security="security"connection="connection"audit="audit"/> <authentication domain="apollo"/> <!-- give admins full access --> <access_rule allow="admins...

ruby on rails - In Place editing -

i followed steps according http://railscasts.com/episodes/302-in-place-editing?view=asciicast but not editing @ attributes place? this page <div class="well-lg box-left box-first"> <div class="row"> <h3>personal details</h3> <br> <ul class="list-group"> <li><strong><div class="col-sm-4">fname </div></strong> <%= best_in_place @user, :fname %></li> <li><strong><div class="col-sm-4">lname </div></strong> <%= best_in_place @user, :lname %></li> <li><strong><div class="col-sm-4">email </div></strong> <%= best_in_place @user, :email %></li> <li><strong><div class="col-sm-4">mobile </div></strong> <%= best_in_place @user, :mob %></li> </ul><br...

Sorting 2d-array in PHP by value -

this question has answer here: how can sort arrays , data in php? 7 answers i have code : $diagnose[$count][$row['result']]; i need sort array value of [$count] as understand, want sort array key value ( $count ). you should use ksort() (low high) or krsort() (high low). sorts array key, maintaining key data correlations. example: $fruits = array("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple"); ksort($fruits); in case should be: ksort($diagnose); to sort value use asort() . find out more here sorting functions: http://php.net/manual/en/array.sorting.php

html - Ipad uploaded image shows 90 degree rotated in desktop all browsers in asp.net c# -

i have uploaded image ipad/iphone (captured in iphone/ipad). it's showing perfect in ipad/iphone browsers, in desktop browsers', it's showing 90 degree rotated. <img> tag below, <img id="main_settingmain_imgphoto" style="height:100px;width:100px;" src="/images/userprofile/test.jpg"> this image in portrait mode displaying in landscape mode in desktop browsers. according link, image in html left turn 90 degree automatically issue , put css allow in mozilla browser. have make <img> tag compatible in desktop browsers'. any suggestion acceptable. i had encountered issue while working 1 website, issue not code image . because captured iphone/ipad. use photoshop edit image, , save in jpg format or accordingly. wont flip on browser. it worked me. give try!

iphone - Autolayout and constraints not working, buttons look different in Xcode than they do in IOS SImulator -

both xcode , iphone simulator set iphone 6. frames updated. changed simulated metrics under attributes inspector iphone 5.5 inch screen. i tried adding constraints width , height received error in xcode every time ran simulator them on took them off. this seems happen lot buttons , labels. been stumped hours, researched could, decide post on here. i joined won't let me post pic of problem because don't have enough rep points. iphone 6s have option when first set them work in 'zoomed view' or normal view. if iphone set in display settings zoomed, display though phone iphone 5/se size, zoomed in. should check constraint's behavior on screen sizes, , i'd confirm if issue checking devices' settings.

go - Golang+PostgreSQL - How to print exact query without escape HTML tags? -

data stored in postgresql: the <b>argentine army</b> is . data type: "content" text collate "default" . when print through golang, become the &lt;b&gt;argentine army&lt;/b&gt; is i need print exact data postgresql without escaping html tags. i'm not sure if go or postgresql issue. below golang codes: package main import ( "database/sql" "github.com/labstack/echo" _ "github.com/lib/pq" "html/template" "io" "log" "net/http" ) // type gallery struct here // type template struct & function here func main() { e := echo.new() // db connection here // parse template & render here e.get("/", func(c *echo.context) error { rows, err := db.query("select uri, title, content gallery id=123") // handle error here gallery := []gallery{} rows.next() { ...

c - Weird error, comparing a char to a string (p == "cancel") -

i'm trying basic if statement , i'm getting weird error string. error 1: comparison between pointer , integer ('int' , 'char *') error 2: result of comparison against string literal unspecified (use strncmp instead) here copy of function occurs in. int logon(int *par) { char p; printf("log student records system\nenter password or type cancel leave\n>"); scanf("%s", &p); if(p == *password1 | p == *password2 | p == *password3) { *par = 2; } else if (p = "cancel") { *par = 3; } else { printf("\nincorrect password try again\n"); } return 0; } the error occurring on else if statement line ( p = "cancel" ). there number of things wrong here. to compare values, use == not = . the logical or operator || not | . char p makes room single charact...

adobe brackets - How to Update HTML website once its already on? -

so not quite know if website actual place ask question please forgive me if not cooperate question asking standards. i making website html , using brackets editor. once purchase domain , post website , on open web ready commercial use, if need change information or add pages? will have open code using brackets, edit it, , somehow replace in place put in first place? or there sort of program can use can update this? i asking suggestions. thank you. this broad question , removed, i'll point in right direction. the exact steps update website depend on web host , server have set up, in general want ftp/sftp client connect server , let upload files (i recommend filezilla ). connect ip address of website , log in, upload new versions of files website. may take few minutes propagate , may have refresh page, that's there it. further help, google tutorial on filezilla.

java - Limit inbound traffic to iOS and Android -

i have native mobile application both ios , android platforms back-end in java (hibernate , spring). , using amazon web services. there way limit inbound traffic requests coming native applications? basically, want make sure users cannot make requests browsers. you cannot use security group prevent connections undesirable clients getting application. when open cidr+port in security group, allows traffic cidr on port through app server, no matter client is. you can implement authentication scheme whereby identify requests desirable clients, not process "unauthorized" requests. such scheme vulnerable spoofing , not rely on 100%.

ruby - Why the large difference between stack memory limit systems? -

i wrote implementation of algorithm course ruby 2.1 running in ubuntu. algorithm easiest express utilising recursion. ruby raising "stack level deep systemstack" exception due large memory requirements of problem , implementation. allow algorithm complete used following commands increase allowable stack size: export ruby_thread_vm_stack_size=16000000 ulimit -s 128000 note both commands above have run. units of ruby_thread_vm_stack_size bytes , units of ulimit kbytes. ruby_thread_vm_stack_size limit ~16mbytes , ulimit limit ~128mbytes. if reduce either limit half it's value shown here algorithm won't finish without exception. can please explain why these limits differ factor of ~8? i've checked i'm able , doesn't seem because 1 of units kbits instead of kbytes. thanks! i believe ulimit needs bigger due ruby's boilerplate around function calls. in /vm_eval.c see this: rb_call0 - used execute ruby's functions. ac...

python - How do I get HoughLines to recognize the rest of the lines in this picture? -

Image
in image below, can see i'm able recognize horizontal lines vertical ones aren't coming out great. in particular, none of middle lines of grids being seen , side lines being overdrawn (i.e. connected each other). here's code created it: img = cv2.imread('./p6.png') gray = cv2.cvtcolor(img,cv2.color_bgr2gray) threshhold, threshhold_img = cv2.threshold(gray, 0, 255, cv2.thresh_binary + cv2.thresh_otsu) edges = cv2.canny(threshhold_img, 150, 200, 3, 5) lines = cv2.houghlinesp(edges,1,np.pi/180,500, minlinelength = 600, maxlinegap = 75)[0].tolist() x1,y1,x2,y2 in lines: cv2.line(img,(x1,y1),(x2,y2),(0,255,0),1) when i've adjusted different parameters, end situations 1 middle vertical line (the 1 ending before jexxy in table) extends bottom through top of third grid. unless relax params every line drawn in, including ones representing yi , er , san @ top of first 3 grids, cannot code see middle verticals defining grid interiors. how can fix this? ...

packages - CentOS6 - Backup all RPMs and installed programs -

is there away backup installed applications/rpms/packages/ (even repositories) (with same exact versions/patches) on 1 script can re-install them on fresh bare bone server of same specs note: can't image or clonezilla tricks note: there 3rd party software not offered repos ... solution should contain backup of these packages (preferably all) thanks! as noted in comment, can backup rpm database , 1 part of replicating configuration server: rpm's database records almost of information regarding packages have installed. using database, in principle script used cpio or pax append of files known rpm database suitably large archive area. rpm -qa gives list of packages, , rpm -ql package gives list of files given package. however, rpm's database not record files created package %pre , %post scripts. likewise, not record working data (such mysql database) may in /var/lib . to handle last 2 cases, going have analysis of system ensure not leave be...