Posts

Showing posts from July, 2013

javascript - How to disabled buttons using AngularJS? -

i have 2 functions in proc.ctrl editprocessrating function disabling save button until user answer question , have view function(viewprocessrating) on function want disable save draft , save both buttons permanently. how can achieve task using angularjs disable functionality ? code far tried below.... html <div class="spaceonbottom text-center"> <button type="submit" class="btn btn-default" ng-click="handlecancel()">cancel</button> <button type="submit" class="btn btn-default" ng-disabled="disabledraft" ng-click="saveprtdraft()" ng-show="showsavedraftbtn">save draft</button> <button type="submit" class="btn btn-primary" ng-disabled="disablesubmitbutton" ng-click="submitclicked()">submit</button> </div> kendogrid.js { field: '', ...

javascript - Handle the response of a submit from within evaluate() -

i'm using phantomjs scrape page , running problem. here's basic user steps it's executing; load login page (using page.open) enter credentials (using page.evaluate within callback passed open) submit form (also in page.evaluate) when user steps in browser post request made submitting form comes couple set-cookies in headers, these cookies necessary subsequent requests. when phantomjs executes these actions cookies fail set proven by; page.open(loginurl, function (status) { if (status === 'success') { //evaluate account , pwd login page.evaluate(function (email, password) { console.log("email: " + email); console.log("pass: " + password); document.queryselector('input[name="theaccountname"]').value = email; document.queryselector('input[name="theaccountpw"]').value = password; document.queryselector('form').subm...

ios - Get access to UIView/UIWindow for the little blue auto correct box -

it seems can access views/windows in ios, don't have experience, hoping can help. in trying resolve this issue , have ideas, require me uiview used little blue box displayed when word autocorrected. i think need start this, have no idea go here: -(void) scrollviewdidscroll:(uiscrollview *)scrollview { nsarray *windows = [uiapplication sharedapplication].windows; (uiwindow *w in windows) { } } i'm adding separate question because can think of other reasons person might want access (maybe change color/style?). understand part of "system" , maybe not best practices modify it, think it's okay long not crucial part of app, , make code pretty safe (i.e.-check pointers nil, error on side of safety). in case, now, want hide it, when should hidden (when scrolling). once realized uiwindow derived uiview came possible answer, seems work far: -(void) walkviews:(uiview*)v { nsstring *classname = nsstringfromclass([v class]); if(...

c# - How can I move the cursor to the end of the text in RichEditBox? -

i'm building windows phone 8.1/windows 8.1 app (winrt) , i'm using richeditbox control. every time add text it, cursor goes beginning of text , can't find way move end of text. i've build 2 methods set , add text: public static void settext(this richeditbox e, string text) { e.document.settext(windows.ui.text.textsetoptions.none, text); } public static string gettext(this richeditbox e) { string value; e.document.gettext(windows.ui.text.textgetoptions.adjustcrlf, out value); return value; } and i'm using code add text it: statusbox.settext(statusbox.gettext() + texttoadd); now, how can move cursor end of text? by manipulating selection property in document property of richeditbox var newpos = statusbox.gettext().length-1; statusbox.document.selection.setrange(newpos,newpos) statusbox.focus(focusstate.keyboard);

How to define key in this code python -

i want code record latest 3 scores each student , when 4th 1 added overwrite oldest score , replace new one. need layout be: f,7,8,9 i have created code when run it asks me define key. code: pname = input("what name") correct = input("what score") score_filename = "class1.txt" max_scores = 3 try: scoresfile = open('class1.txt', "r+") except ioerror: scoresfile = open('class1.txt', "w+") # file not exists actualscorestable = dict() line in scoresfile: tmp = line.replace("\n","").split(",") actualscorestable[tmp[0]]=tmp[1:] scoresfile.close() if pname not in actualscorestable.keys(): actualscorestable[pname] = [correct] else: actualscorestable[pname].append(correct) if max_scores < len(actualscorestable[pname]): actualscorestable[key].pop(0) scoresfile = open(score_filename, "w+") # truncating file (write again) key in actualscores...

c# - What is the ideal structure for handling nonce? -

i keep track of .... of nonces . should track nonce value , expiration date. structure should allow fast lookup of nonce, dictionary, allow reasonably efficient cleanup, e.g., pop expired nonces , stop when no longer need pop them. recommend? expiration hacks (e.g., limited size rotating buffer) too. without further information typical usage patterns, dictionary keyed nonce containing expiration value , reverse lookup of exipration time set of nonces expire @ time seems efficient. if know lifetime of nonces , stage within lifetime typically accessed, may more efficient use following strategy instead: have buckets represent expiration time range. in each bucket, have dictionary keyed nonce, value being expiration time. when nonce comes in, in recent bucket first. if not there, check additional buckets in order of expiration. if find nonce in bucket, verify it's expiration date has not passed. cleanup simple of disposing buckets past allowed nonce duration. ...

How to create a new CloudBlobContainer instance for my .NET MVC project (on Azure storage emulator )? -

i have sample .net web-app project using sql db , azure blob storage. want have several versions of same project (copy, paste, , renanme folder -> , open in vs2013), problem each project copy points same database , azure blob. has created problems when running new modified copies of same project. searching web, found entityframework code-first create new database project: go web.config file -> connection string -> , renaming 'initial catalog' property. old .mfd file remains, new 1 created following new name given. i assuming similar possible azure blob containers? how can this? have tried rename cloudblobcontainer object instance (within class code), creates errors when running. also, why cloudblobcontainer object assigned name in code, imagesblobcontainer, when under vs2013 -> server explorer -> azure -> storage -> development -> blobs -> here appears 'images'? shouldn't not have same name? just sql db connection string...

Remove part of string after or before a specific word in java -

is there command in java remove rest of string after or before word; example: remove substring before word "taken" before: "i need words removed taken please" after: "taken please" string immutable, can find word , create substring : public static string removetillword(string input, string word) { return input.substring(input.indexof(word)); } removetillword("i need words removed taken please", "taken");

mysql - SQL group by using distinct column -

i collecting lap times in sql database , having difficulties extracting drivers fastest laptimes! the structure looks following! create table if not exists `leaderboard` ( `id` int(11) not null auto_increment, `driver` varchar(50) not null, `car` varchar(50) not null, `best` double not null, `guid` bigint(255) not null, `server_name` varchar(255) not null, `track` varchar(55) not null, primary key (`id`), key `driver` (`driver`), key `server_name` (`server_name`) ) engine=innodb default charset=latin1 auto_increment=1213 ; data example insert `leaderboard` (`id`, `driver`, `car`, `best`, `guid`, `server_name`, `track`) values (1, 'dave.38', 'bmw_m3_e30', 88.379, 76561198084629688, 'a++%21+a++%21+------+saturdaynightracing.tk+-+%5brace-server%5d+-+%5bmagione%5d+%23snr', 'magione'), (2, 'gabriel porfírio', 'bmw_m3_e30', 87.318, 76561197987062834, 'a++%21+a++%21+------+saturdaynightracing.tk+-+%5brace-server...

jquery - Slide Up Footer OnHover and OnClick? -

i looking modify these 2 slideup footer examples work on mobile devices. how add onclick open , onclick close these on mobile , still have onhover work desktop use? the close , open onclick need active on "footer button" text or set of 2 images (1 footer button open, , 1 footer button close) added later. http://jsfiddle.net/aqmhb $(".footer").hover(function () { $(".slide").slidetoggle("fast"); }); http://jsfiddle.net/a88m6 $(".footer").hover(function () { $(this).animate({height: 250}); }, function(){ $(this).animate({height: 25}); }); you can user agent determine if being seen on mobile or desktop, , handle each independently accordingly. check user agent is, bind events how handled.

Java implementation of 3DES and DUKPT for decryption of credit card reader data through keyboard emulation? -

we have online key-in interface, , support credit card swipe capability. in industry today, card reader should encrypt information before encoding ascii, , server-side decrypt. (so local machine never sees card info) i using magtek card reader in keyboard emulation mode, , have ansi standard key injected testing purposes. once decode & decryption successful, we'll our own key registered magtek , order production-use readers. i know decryption has been implemented before in c# , other languages, need in java, or perhaps other cli-accessible program can included java webapp. proceed porting c# code java, first need set c# environment. (i've never done before.) once i've ensured c# version works well, know can eliminate errors during porting usual debugging techniques. before go through of this, if there easier way please let me know. think has been done in java, perhaps not... partial answer, cw add to. first, it's not clear (to me) if want run ...

jbossfuse - Jboss Fuse 6.1.0 upgrade camel feature version -

i have been working jboss fuse 6.1.0.redhat-379 month great results , higher productivity in eip. thank community building such great product. now getting ready deploy bundles in dev enviroment several camel routes , multiple camel contexts in single bundle , i'm noticing weird behavior regarding camel contexts jmx display. bundle multiple camel contexts showing first context, others contexts work fine missing in camel jmx display in hawtio. after research behavior encountered jira issue https://issues.apache.org/jira/browse/camel-7545 opened claus, describing problem , manifesting there fix versions (2.12.4, 2.13.2, 2.14.0) afaik jboss fuse version distributed camel 2.12.0.redhat-610379 version , there mayor 2.14.0.redhat-620031 version supposedly fix issue , bring many other features json path , sql generated keys. is there way upgrade versions of camel features in jboss fuse? update there similar question topic ( updating camel version in fuse esb ) accepted ans...

excel - Select and extract row of data to another sheet -

i'm working big worksheet containing stocks information, columns organized : id date time price quantity nbe it goes on 500k+ rows, , have 10+ sheets go through. need extract first 2 trade of each trading day, , create new list on new sheet (sheet1). first trade of every day @ "09:00:00". so far wrote piece of code, in tried copy 2 lines need , paste them sheet1 creating new list. runs without errors, nothing shows up... sub macro1() = 2 range("c2").select range(selection, selection.end(xldown)).select each cell in selection if day(.range("b" & crow).value) <> day(.range("b" & crow - 1).value) activecell.entirerow.copy activeworkbook.sheets("sheet1").rows(i).paste activecell.offset(1).copy activeworkbook.sheets("sheet1").rows(i + 1).paste = + 2 end if next cell end sub shouldn't select , copy paste 2 rows together? or possible create range ...

ffmpeg - Node.js spawn not working with quotes inside argument -

i'm trying run command spawn var args = ['-ss','00:00:15','-i',storage_path + doc.file_name,'-vframes','1','-vf','"scale='+size*2+':ih*'+size*2+'/iw,crop='+size+':'+size+'"','-f','image2','-q:v','5',storage_path + output_name]; var command = spawn('ffmpeg', args); the issue seems part here: '"scale='+size*2+':ih*'+size*2+'/iw,crop='+size+':'+size+'"' when log args, get: [ '-ss', '00:00:15', '-i', '/a/video.mp4', '-vframes', '1', '-vf', '"scale=150:ih*150/iw, crop=75:75"', '-f', 'image2', '-q:v', '5', '/a/75.jpg' ] if take that, , .join(' ') , command: -ss 00:00:15 -i /a/video.mp4 -vframes 1 -vf "scale=150:ih*150/iw, crop=75:75" -f image2 -q:v 5 /a/75.j...

node.js - Fallback or Disable Angularjs HTML5 pushstate in IE9 -

i know question raised haven't came across i'm looking for. pushstate works in modern browser , have created corresponding routes in nodejs make deeplink url work. in ie9 works based on hashtag , disable hash navigation , make page reload. below sample please share suggestions. my app behind sso using saml strips hash url during redirect. prefer go page refresh ie9 , below without making changes in angular. var scotchapp = angular.module('scotchapp', ['ngroute']); http://runnable.com/vqyiqp-egbls-for/nodejs-angularjs-history-for-express-and-node-js -- update-- now have enabled route browsers supports push state. ie9 normal page reload , routing broken now. i'm trying figure out trigger controller dynamically. -- update on 03/25/2015 -- i have created hack ie9 , used nginclude instead of ngview . demo updated code can try in ie9 , other modern browsers. -- update on 03/30/2015 -- runnable demo not saved , published before, upada...

MikroTik Hotspot trial user bandwidth limit -

does know how limit mikrotik hotspot trial user bandwidth limit? need make limit (e.g. 10m) trial users can't use more 10m (e.g. 4 trial users , each can use 2,5m 10m, 10m/trial_users). you should use queues, or in more complicated situations queue trees. can find details of using queues here, @ mikrotik wiki: http://wiki.mikrotik.com/wiki/manual:queue

What is the proper way to declare calculated fields in AngularJs' model? -

how should declare calculated field in angularjs model? if this: $scope.model = { id: null, calculatedfield: function() { return 1+2; } }; and send whole object web server this: $http.post(url, $scope.model)... it sends null calculatedfield field value. seemingly expects properties, not functions while serializing object json. update: want calculatedfield() being automatically called every time model serialized in json if calculatedfield should behave value make getter : $scope.model = { id: null, calculatedfield() { return 1+2; } }; you can use regular value property except can't assign value it. of course, gets serialized properly. var x = $scope.model.calculatedfield; // x = 3 $scope.model.calculatedfield = 4; //doesn't change calculatedfield json.stringify($scope.model); // "{"id":null,"calculatedfield":3}" getters regular javascript btw.

javascript - Updating an ng-repeat property in one controller based on the ng-repeat property of another controller? -

i have 2 separate angular controllers, 1 in main content area ( homectrl ) showing list of events, , 1 in sidebar ( sidebarctrl ) showing list of tags events. // homectrl.js $scope.events = [{ name: "example event name", tags: [ { "id":7, "name":"imaginon", "following": "false" }, ] }]; in sidebar controller have collection of used tags: // sidebarctrl.js $scope.tags = [ { "id":17, "name":"mintmuseum", "following": "true" }, { "id":7, "name":"imaginon", "following": "false" }]; i if user starts following tag in sidebar, tag gets highlighted in both sidebar , in home feed. if just trying highlight in sidebar easy enough: // sidebar.html <div ng-repeat="tag in tags"> <li ng-class="{highlighted: tag.following}...

Java print arraylist numbered -

i have this public string tostring() { return "a " + year + " " + make + " " + model + " vin# of " + vin + " , mileage of " + miles; } and this: arraylist<auto> autos = new arraylist<auto>(); and this: public static void loadnewdata(arraylist<auto> a, arraylist<customer> c) { a.add(new auto(2009,"ford" , "mustang","abc123", 1256.54)); a.add(new auto(2010,"chevy","camero","qwi459", 33.98)); a.add(new auto(1970,"pink","cadillac","950akh", 212874.51)); a.add(new auto(2007,"lotus","elise mkii","1a2d3f", 12859.90)); c.add(new customer( "brett farve",false)); c.add(new customer( "bruce springsteen",true)); c.add(new customer( "mickey mouse", true)); c.add(new custo...

Jenkins plugin design with radioblock -

all, i have been trying figure ui piece of jenkins plugin few hours now. trying nest checkboxes inside radioblock. problem having checkboxes not hidden when page loads @ first. hide them have highlight radio deselect. <f:section title="deployment method"> <f:radioblock checked="true" name="deploymethod" title="deploy new servers" value="deploy new servers"/> <f:radioblock checked="false" name="deploymethod" title="script deploy" value="script deploy"> <j:foreach var="script" items="${account.scripts}"> <f:entry> <f:checkbox name="scripts" value="${script.scriptname}" title="${script.scriptname}"/> ...

plsql - Oracle : Error at line 28: PLS-00103: Encountered the symbol “end-of-file” -

i have problem , cant figure out. shows.... error @ line 28: pls-00103: encountered symbol "end-of-file" when expecting 1 of following: begin end function pragma procedure create or replace package body check_emp_pkg is procedure chk_hiredate (p_date in employees.hire_date%type) this code below: create or replace package body check_emp_pkg procedure chk_hiredate (p_date in employees.hire_date%type) begin if months_between(sysdate, p_date) > g_max_length_of_service * 12 raise_application_error(-20200, 'invalid hiredate'); end if; end chk_hiredate; procedure chk_dept_mgr (p_empid in employees.employee_id%type, p_mgr in employees.manager_id%type) begin declare v_mgr_id departments.manager_id%type; begin select manager_id v_mgr_id departments; if p_mgr = v_mgr_id dbms_output.put_line('success'); else ...

java - Front Camera Record Video Failed -

i trying record audio by front camera in 1 of activities using mediarecorder. part of code shown below. if open camera, works well. if open front camera, there no runtime error can't open output mp4. under corresponding path there generate new mp4 file, file size looks normally, 11.2m forexample. if press open it, shows "sorry, cann't open file". part of cameraservice.java @override public int onstartcommand(intent intent, int flags, int startid) { log.d("tag", "======= service in onstartcommand"); if (util.checkcamerahardware(this)) { mcamera = util.getcamerainstance(); if (mcamera != null) { surfaceview sv = new surfaceview(this); windowmanager wm = (windowmanager) getsystemservice(context.window_service); windowmanager.layoutparams params = new windowmanager.layoutparams(1, 1, windowmanager.layoutparams.type_system_overlay, windowman...

javascript - Angular UI & Bootstrap: Collapse Mobile Navbar on Link Click -

i have functioning bootstrap navbar through use of ui.bootstrap of angular-ui. mobile navbar, want navbar collapse when link clicked. toggle button functions expected, can't ng-click="iscollapsed = !iscollapsed" work on nav links. <div class="navbar navbar-default navbar-fixed-top" ng-controller="navbarctrl"> <div class="container"> <div class="navbar-header"> <button class="navbar-toggle" type="button" ng-click="iscollapsed = !iscollapsed"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a href="/" class="navbar-brand">app</a> </div> <div collapse="iscollapsed" class=...

Uncaught SyntaxError: Unexpected token ILLEGAL on javascript objects -

i trying create object in javascript has object inside of , getting following error: uncaught syntaxerror: unexpected token illegal this code var motivateen = { 0 : {0: "{name}, keep studying lesson better score.", 1: "bad luck {name}, keep studying lesson improve. "}, 50:{0: "practice makes perfect {name}, try lesson again.",1:"not bad, better luck next time {name}!",2:"well done {name}, you’re on right track!"}, 85:{0:"congratulations {name}, lesson complete!",1:"woohoo, lesson complete {name}!",2:"awesome stuff {name}! keep up!",3:"great skills! done {name}! "}, 100:{0: "perfect {name}! keep work!",1:"congratulations {name}, got perfect score!"} }; if take code , format it, error more obvious: var motivateen = { 0: { 0: "{name}, keep studying lesson better score.", 1: "bad luck {name}, keep studying les...

c - I'm attempting a scanf inside a function and outputting it to another. currently its not outputting correctly. im not sure what I'm missing -

int read_number(int* value) { scanf("%d",&value); printf("%d\n",value); } int main() { int x=1; read_number(x); printf("%d",x); return 0; } here's how code should be: int read_number(int *value) { scanf("%d", value); printf("%d\n", *value); } int main() { int x=1; read_number(&x); printf("%d", x); return 0; } you pass pointer parameter function, can dereference pointer , assign new value. by way, it's best practice not use scanf() unsafe. should use fgets() , sscanf() .

css - Is there a way to detect when a row changed with a UL of float-lefted LIs? -

here's example list have of products: http://imgur.com/7igthia i've got function runs on document-ready cycles through each list , adjusts height of span around img, space uniform throughout entire list. what i'm wondering is, there way have detect when "row" changes, spans appear as-is on first row (as they're sized appropriately based on first two, on second row, single entry, span height of image? the function same thing height of li elements, , i'll adjust size per row well, if there's workable solution. this function runs calculate height, if it's of use: if ( jquery('.product_list').length ) { var tallest = 0; var tallest_img = 0; jquery('.product_list li').each( function() { if ( jquery(this).height() > tallest ) { tallest = jquery(this).height(); } if ( jquery(this).children('a').children('span').children('img').height() > tallest_img ) { t...

Java compiler error when trying to override superclass interface -

i don't understand why i'm getting compiler error when try , override push method below. the exact output error in eclipse "name clash: method push(t) of type stackimplementation has same erasure push(object) of type stack not override it" public interface stack<t> { t pop(); void push(object t); } public class stackimplementation<t> implements stack{ private final deque<t> deque = new arraydeque<t>(); @override public t pop() { return deque.removefirst(); } @override public void push(t t) { deque.addfirst(t); } } thank you! you have 2 errors: push in interface uses object , should t : void push(t t); class implements stack , should stack<t> : class stackimplementation<t> implements stack<t> {

wordpress - Woocommerce product admin sort by stock -

is there anyway can sort stock? since reads 'stock x 30' helpful if sort high or low. there code can add functions.php enable feature? easy enough... can accomplished code... add_filter( 'manage_edit-product_sortable_columns', 'rei_product_sortable_columns' ); function rei_product_sortable_columns( $columns ) { $custom = array( 'is_in_stock' => 'is_in_stock' ); return wp_parse_args( $custom, $columns ); } but sort stock column has... example, 'in stock' or 'out of stock' to have custom sort, (for example, using stock number), may follow instruction on blog post .

forms - jQuery .change() isn't firing as expected for a dropdown list, and I can't see why -

Image
i having trouble spotting why jquery function isn't working expected. goal send ajax call server when dropdown changes, update fields in next half of form: with extraneous functions removed, jquery looks this: $(document).ready(function(){ //re-load form when new game type selected $("#meta_game_type_dropdown").change(function(){ alert('woop'); $.post('http://client2.dev/index.php/match/create_match_form', { game_type: $('#meta_game_type_dropdown').val(), }, function(data, status){ $('#match_form').html(data); $('.numeric_only').forcenumeric(); //set default time current time $('#meta_time_input').setnow(); }); }); }); however, i'm not getting woop alert when change dropdown. have confirmed id correct: <select name="game_type" id="meta_game_type_dropdown"> so i...

c# - Counting Database records that meet criteria and displaying in view -

using mvc5 ef6 vs2013 i relatively new mvc , web development in general , wondering best way query database , count number of records meet criteria out of total number of records. in case want count number of active vehicles . i have used method know display both active , inactive records in table querying database table of vehicles , creating model of active status , counts the relevant bits model, controller , view below. model namespace atas.models { public class activevehicles { public bool active { get; set; } public int vehiclecount { get; set; } } } controller public actionresult index() { iqueryable<activevehicles> data = vehicle in db.vehicles group vehicle vehicle.active active select new activevehicles() { active = active.key, ...

mysql - database query possibility? -

1)access password 3 (student,teacher,alumni)tables if given mail id matches mail id 2) want write 1 program password recovery these 3 users the code accessing 1 password 1 table is select password current_student mail_id='"+mail_id+"' another code (select password r_password,mail_id r_mail_id current_student having mail_id = 'mahender0791@gmail.com') union (select password r_password,mail_id r_mail_id dept_staff having mail_id = 'mahender0791@gmail.com') union (select password r_password,mail_id r_mail_id alumni having mail_id = 'mahender0791@gmail.com') and error message is query: (select password r_password,mail_id r_mail_id current_student having mail_id = 'mahender0791@gmail.com') union (selec... error code: 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near 'having mail_id = 'mahender0791@gmail.com') limit 0, 1000' @ line 1 could thi...

php - Phpmailer working fine in localhost But not in server -

date_default_timezone_set('asia/dubai'); include("classes/class.phpmailer.php"); $mail = new phpmailer(); $body = "this <strong>testing</strong> mail ". date('y-m-d h:i:s'); $mail->issmtp(); // telling class use smtp $mail->smtpdebug = 1; $mail->smtpauth = true; $mail->smtpsecure = "ssl"; $mail->host = "smtp.gmail.com"; $mail->port = 465; $mail->username = 'my@email.com'; $mail->password = '*******'; $mail->setfrom('my@email.com', 'first last'); $mail->addreplyto('my@email.com','first last'); $mail->subject = "phpmailer test subject via smtp (gmail), basic"; $mail->altbody = "to view message, please use html compatible email viewer!"; // optional, comment out , test $mail->msghtml($body); $address = "to@email.com"; // add address here ...

Javafx css achieve this sort of effect on text -

Image
i trying style text in javafx application making use of css. effect trying achieve this: i have font, effect missing. .css file contains text. .progress-view .title { -fx-font-family: "bilbo swash caps"; -fx-font-size: 34px; -fx-text-fill: white; -fx-blend-mode: darken; -fx-opacity: 0.8; -fx-effect: innershadow(gaussian , rgba(0,0,0,0.2),6,0.0,0,2); } the effect have not remotely close this. achievable manipulating effect or else? thanks using following seem have gotten text second 1 (bottom) enough me: .progress-view .title { -fx-font: 60px "bilbo swash caps"; -fx-fill: white; -fx-stroke: black; -fx-stroke-width: 2; -fx-blend-mode: darken; } would see smokey effect of other 1 though, post solutions found. thanks!

include - Mutual Import C++ -

i know reoccurring question, far have seen answer “if have mutual imports doing wrong”. that why have more of general understanding question 1 tied specific code. okay, example. have data structure dynamic automaton. states of automaton structs attribute “transitions”. “transitions” dynamic linked list. list elements structs have attribute state object... so: // state.h #include "transitionlist.h" state{ transitionlist transitions; // transitions going out state } // tranistion.h #include "state.h" transition{ transition* next_transition; // next transition in transitionlist state* successor; // pointer next state in automaton } // transitionlist.h #include "tranisiton.h" transitionlist{ // *code* class linked list of transitions } so have state.h -> tranistion.h -> transitionlist.h -> state.h -> … this circular... conceptual mistake? don't see how bad layout formal point of view. please enlighten me ...

sqlite - Rails app with postgresql; query with .take does not keep the order of records -

i have rails 4 application , switched sqlite postgresql. have following 3 models; class user < activerecord::base has_many :user_games has_many :games, :through => :user_games end class game < activerecord::base has_many :user_games has_many :users, :through => :user_games end class usergame < activerecord::base belongs_to :user belongs_to :game end with records: game id 1 usergame id user_id game_id 1 5 1 2 3 1 user id 1 2 i sqlite: game = game.find(1) game.users.take(2).first which return user id 5. the same code postgres gives user id 3. why? edit: i forgot add need users in order appear in table. so if... game id 1 2 usergame id user_id game_id 1 5 1 2 3 1 3 1 2 4 4 2 user id 1 2 3 4 ... need query preserves order of users, game1.users.first.id = 5 , game2.users.first.id = 1 game1.users.take(2).first.id preserve order w...

java - inserting byte array into blob column -

i'm trying insert byte array blob column in sqlite database. i've tried both setbinarystream , setbytes, i'm getting not implemented sqlite jdbc driver exception. i'm using sqlite-jdbc-3.8.7.jar.what jar should use work? thanks! here's code: public void adddriverdata(string prenume,string nume,string telefon,string email,string permis,string parola,byte[] photo) throws sqlexception { string sql = "insert driver(first_name,last_name,phone,email,permit,password,photo)values(?,?,?,?,?,?,?)"; preparedstatement stm = c.preparestatement(sql); stm.setstring(1,prenume); stm.setstring(2,nume); stm.setstring(3,telefon); stm.setstring(4,email); stm.setstring(5,permis); stm.setstring(6, parola); //stm.setbinarystream(7,new bytearrayinputstream(photo),photo.length); stm.setbytes(7, photo); system.out.println(sql); stm.executeupdate(sql); stm.close(); c....

google app engine - How can I upload to BlobStore from a url in java -

how can upload file programmatically url blobstore? for instance, when using facebook login, app gets url of profile picture, , fetch , upload blobstore. examples in https://cloud.google.com/appengine/docs/java/blobstore/#java_uploading_a_blob not help, app knows url, don't want involve user in uploads. you have use google cloud storage storing such files. see appengine examples @ https://cloud.google.com/appengine/docs/java/googlecloudstorageclient/getstarted

c# - ASP.NET Windows Authentication: Always prompt for credentials? -

i've inherited application uses windows authentication. problem need have application prompt credentials because different people need login , use it. web.config simple: <authentication mode="windows" /> <authorization> <allow roles="application_whitelist" /> <deny users="?" /> </authorization> so add/delete users "application_whitelist" control access application. problem, of course, we're not being prompted our credentials. there way force occur? (i checked asp.net windows authentication should ask credentials no help.) what clearing cache @ browser close event? @ link . hope you.

c - Integer arithmetic: Add 1 to UINT_MAX and divide by n without overflow -

is there way compute result of ((uint_max+1)/x)*x-1 in c without resorting unsigned long (where x unsigned int )? (respective "without resorting unsigned long long " depending on architecture.) it rather simple arithmetic: ((uint_max + 1) / x) * x - 1 = ((uint_max - x + x + 1) / x) * x - 1 = ((uint_max - x + 1) / x + 1) * x - 1 = (uint_max - x + 1) / x) * x + (x - 1)

python - Why doesn't numpy determinant return a Fraction when given a Fraction matrix? -

i want perform operations on rational matrices. use modules numpy , fractions . here code: import numpy np fractions import fraction m=np.matrix([[fraction(1, 6), fraction(8, 7)], [fraction(1, 2), fraction(3, 2)]]) print(np.linalg.det(m)) # gives -0.321428571429 print(m[0,0]*m[1,1] - m[0,1]*m[1,0]) # gives -9/28 since computing determinant require rational operations gauss' method, determinant of rational matrix rational. so questions are: why numpy return float , not fraction? how can rational determinant? note other operations on matrix give rational output (for instance m.trace() ). numpy computes determinant of matrix lower upper decomposition routine in lapack. routine can handle floating point numbers. before calculating determinant of matrix, linalg.det checks types of values has , establishes type of internal loop should run using call function named _commontype() . function set loop run either double or complex-double values. here python part...

c - Writing out an array using fprintf -

i'm having trouble writing array of double numbers in text file. problem is, code runs, doesn't write out anything. #include <stdio.h> #include <stdlib.h> int main() { file *out; double numbers[30]; int i=0; for(i;i<30;i++) scanf("%lf", &numbers[i]); out=fopen("out.txt", "w"); if (out == null) { fprintf(stderr, "error in opening .txt"); exit(exit_failure); } while ( i<30 ) { fprintf(out, "%.3f", numbers[i]); i++; } fclose(out); return 0; } basically, code supposed write out array of 30 double numbers in text file, , round decimals '.3'. you forgot re-initialise i 0, hence current value of i 30, causes while loop not execute . = 0; //re-initialise i. while ( i<30 ) { fprintf(out, "%.3f", numbers[i]); i++; } it better, if use ...

osx - Kulture error - kpm command not found -

i installed sublime text 3 aim of coding c# on mac. followed steps on http://www.omnisharp.net installation of plugins , works fine until try build simple "helloworld" project. error /users/guevara/library/application support/sublime text 3/packages/kulture/build.sh: line 21: kpm: command not found i did check have asp.net 5 kvm mac installed. following steps @ http://www.enterpriseframework.com/post/2014/12/02/how-to-mac-vnext-step-by-step-setup-and-first-app works, kpm command has been installed through homebrew. any idea doing wrong or why kulture can't find kpm command? thanks, alex look @ last line of installing kvm on os x instructions @ https://github.com/aspnet/home : run command source kvm.sh on terminal if terminal cannot understand kvm. but beta3 there's issue in kulture's build.sh , have updated 4 1st lignes: ver=`cat ~/.k/alias/default.alias` add_to_path=$home"/.k/runtimes/"$ver"/bin" expor...

wordpress addthis plugin causing extra chars on home page excerpt -

i using wordpress wordpress 4.1.1 hueman theme version: 1.5.4. when installed , configured addthis wordpress plugin version 4.0.7. started seeing +-* in beginning of every post excerpt on home page of website. on post page seems fine. not sure do. when disable plugin goes of when enable again comes back. website: fossbytes.com the plugin not rendering share buttons correctly (under excerpt). quick fix install older version https://wordpress.org/plugins/addthis/developers/ 4.0.3 has corrected issue me.

Bootstrap working only on IIS Express -

i have simple asp.net site under .net 4.5 in visual studio 2013 (iis express) it's working fine. when copy (not publish) site, bootstrap not working. have menu, using "dropdown-toggle" class , it's not working there. under f12 tools chrome see js errors uncaught syntaxerror: unexpected end of input --on jquery uncaught error: bootstrap's javascript requires jquery -- on bootstrap./js also when shrink browser cell phone, menu replaced 3 lines it's not expanding. missing here ? thank ! your path sources not correct. try link online sources like: bootstrap cdn sources . to expand menu have include jquery.

php - Laravel Eloquent Query Buliding -

i have 4 tables , giving table structure here user_work ['id', 'user_id', 'work_id'] work_sectors ['id', 'name', 'status'] works ['id', 'work_sector_id', 'work_type_id', 'work_duration_id', 'name'] users ['id', ...] and models are class user extends eloquent implements userinterface, remindableinterface { use usertrait, remindabletrait; protected $table = 'users'; public function work() { return $this->belongstomany('work', 'user_work'); } } class work extends \eloquent { protected $fillable = []; protected $table_name = 'works'; public $timestamps = false; public function user() { return $this->belongstomany('user', 'user_work'); } public function sector() { return $this->belongsto('worksector', 'work_sector_id'); } } in controller have written code $user = user::with(...

java - Graphics are flickering when I draw with double buffering -

i'm building simple 2d java game , having flickering issues though draw graphics using double buffering technique. i've got started , have simple game loop far. think should work fine anyway? without flickering.. here's how it: @override public void run() { while (running) { currentstate.update(); preparegameimage(); currentstate.render(gameimage.getgraphics()); repaint(); try { thread.sleep(14); } catch (interruptedexception e) { e.printstacktrace(); } } system.exit(0); } @override protected void paintcomponent(graphics g) { super.paintcomponent(g); if (gameimage == null) { return; } g.drawimage(gameimage, 0, 0, null); } private void preparegameimage() { if (gameimage == null) { gameimage = createimage(gamewidth, gameheight); } graphics g = gameimage.getgraphics(); g.clearrect(0, 0, gamewidth, gameheight); } you can see h...

routes - Symfony 2, how do I handle routing for multiple domains? -

i have site let create there own site our sub-domain , can use there own custom domain. user_site: resource: "routing_user_site.yml" host: "{subdomain}.{domain}" requirements: domain: %domain% defaults: domain: %domain% # our site site: host: %domain% resource: "routing_our_site.yml" prefix: / the above route works fine, i'm not sure how redirect other domains, not our main domain route routing_user_site.yml file i have added this, doesn't work custom_site: host: "{domain}" resource: "routing_user_site.yml" prefix: / requirements: domain: !(%domain%) in symfony2, order of routes important. if 1 route not matched, framework test next. that means, in case, don't have !(%domain%) , put rule without requirement catch other routes. user_site: [...] site: [...] custom_site: resource: "routing_user_site.yml" pre...

centos6 - Make SSL faster on Linux CentOS with Apache 2.4 OpenSSL 1.0 -

colleagues! well, huge problem speed of ssl authentication. since move website ssl, googlebot reduce indexing of website, because ssl negotiation below value got webpagetest.org: url: https://www.musiconline.com.br/jorge-e-mateus/alcapao/ host: www.musiconline.com.br error/status code: 200 client port: 0 start offset: 0.735 s dns lookup: 34 ms initial connection: 170 ms ssl negotiation: 531 ms time first byte: 311 ms content download: 178 ms bytes in (downloaded): 13.2 kb bytes out (uploaded): 0.4 kb look, "ssl negotiation" in 531ms, big value. someone know how can solve issue? i verified mod_spdy, however, can't install because follow message in linux centos 6, apache 2.4: root@server1 [/home/login/src]# rpm -u mod-spdy-*.rpm warning: mod-spdy-beta_current_x86_64.rpm: header v4 dsa/sha1 signature, key id 7fac5991: nokey error: failed dependencies: httpd >= 2.2.4 needed mod-spdy-beta-0.9.4.3-420.x86_64 mod_ssl >...

c# - C#I have made is a coI have made is a co -

the calculator have made combination of textboxes , radiobuttons , when 'calculate' clicked, message box check whole program , (if necessary) display message box saying 'the following areas still need completing' , list areas. i know how code basic if li have made co't know how check multiple textboxes , radiobuttons in 1 go. the current code button is: private void button4_click(object sender, eventargs e) { drawforce = (area2 * (strengthcoeff / (workhardexp + 1)) * (math.pow(math.log(area1 / area2), workhardexp + 1))); drawforce = math.round(drawforce, 2); textbox7.text = drawforce.tostring() + " n"; } i don't wish copy enter code onto here hope suffice thanks if understand correctly, you're looking way check many controls on form in loop. there couple of ways this. one way create class-level collection on form holds references controls. example, this: private ienumerable<textbox> textboxes = new lis...

python - PyQt4 members issues -

i have updated python(x,y) latest version. i have script working before , showing more 40 erros this: module 'pyqt4.qtcore' has no 'qthread' member module 'pyqt4.qtcore' has no 'pyqtsignal' member module 'pyqt4.qtgui' has no 'qwidget' member .... ... , on seems somethings wrong pyqt4??? at begining of script have tried like: from pyqt4.qtcore import * pyqt4.qtgui import * pyqt4 import qtcore, qtgui, qt nothing works. can me?

php - Session start validation -

i have function: public static function sessionstart() { try { if (ini_get('session.use_cookies') && isset($_cookie['phpsessid'])) { $sessid = $_cookie['phpsessid']; } elseif (!ini_get('session.use_only_cookies') && isset($_get['phpsessid'])) { $sessid = $_get['phpsessid']; } else { session_start(); return false; } if (preg_match('/[^a-za-z0-9\-]{32}/i', $sessid)) { return false; } session_start(); return true; } catch (exception $ex) { return false; } } however, in cases, session_start still throws warning. how validate session id never warnings? problem started creep in when changed php version 5.3 5.6. warning: the session id long or contains illegal characters, valid characters a-z, a-z, 0-9 , '-,' one solution use php error control...

wordpress - Woocommerce Composite Product Dynamically Change Featured Image Based on a Selection -

i building online store (computer store precise). i'm having problem figuring out how change composite products image image dynamically based on selection. (case) i've asked question on woo-themes no avail. possible using template files , not hard-coding plugin itself?

arrays - Armstrong Numbers using JavaScript -

this not question, more of public help... given assignment find armstrong numbers within 100 (there 0 , 1) assignment. searched internet find such program, none. methods arrays , other stuff available , didn't have time asking , getting script done... so, here give javascript program finding armstrong numbers... know method redundant, , if have better idea in mind, please share... thank you. var = []; var b = new array(); (var ii = 0; ii < 3; ii++) { b[ii] = new array(1001); (var j = 0; j < 1001; j++) { a[j] = 0; b[ii][j] = 0; } } for(var = 0; < 1001; i++) { a[i] = i; b[0][i] = a[i] % 10; b[1][i] = math.floor(i / 10); b[1][i] = b[1][i] % 10; b[2][i] = math.floor(i / 100); b[2][i] = b[2][i] % 10; if (i === math.pow(b[0][i], 3) + math.pow(b[1][i], 3) + math.pow(b[2][i], 3)) { console.log(i + " armstrong number."); } } ...

c++ - What is an undefined reference/unresolved external symbol error and how do I fix it? -

what undefined reference/unresolved external symbol errors? common causes , how fix/prevent them? feel free edit/add own. compiling c++ program takes place in several steps, specified 2.2 (credits keith thompson reference) : the precedence among syntax rules of translation specified following phases [see footnote] . physical source file characters mapped, in implementation-defined manner, basic source character set (introducing new-line characters end-of-line indicators) if necessary. [snip] each instance of backslash character (\) followed new-line character deleted, splicing physical source lines form logical source lines. [snip] the source file decomposed preprocessing tokens (2.5) , sequences of white-space characters (including comments). [snip] preprocessing directives executed, macro invocations expanded, , _pragma unary operator expressions executed. [snip] each source character set member in character literal or string literal, e...