Posts

Showing posts from May, 2015

networking - ping with tcpflow and tcpdump -

when use tcpflow icmp , ping have no answer, when use tcpdump icmp aand ping i'm getting answer. wrong tcpflow configuration or should that? when use tcpflow icmp , ping have no answer uh... how this: tcpflow captures data tcp connections , icmp messages (e.g., pings & etc) not part of tcp connections.

sass - How do you handle compiled files from pre-processors in git commits? -

we meta languages sass/scss, less, coffeescript, etc. when comes git commits there 1 question: should compiled files source files repo or better ignore them? problem is, when ignoring files, 1 not use repository out of box. you've compile first (to right location) before using it. kinda bad way, because not using pre-processors. how deal it? git used source-tracking system, , such meant use developers of project. people development on project need able build source files generated files. in case not having generated files in repository doesn't impose additional burden on them. to useful end-users, may want periodic releases of project. these typically done archives of necessary files. include generated files, , quite-possibly exclude source files. end-user git seen unnecessary tool. including generated files in repository doesn't either of class of people, , makes more difficult see being changed each commit.

html5 - jQuery (or CSS3) Switch between content sections on scroll -

i hope can point me in right direction. i replicate navigation, similar 1 on website: http://vsamarehorosho.ru/ basically, idea don't allow user have different sections of website on screen @ same time. so, if section larger screen scrolls until reach bottom of section. if scroll further, jump onto next section. if section smaller screen size, see main section @ top , part of next section down bottom, when try scroll, next section jumps top , 1 after shows down bottom if 1 smaller screen size. on example, slides 100% height, that's not achievable. hope can me. wrap sections in div height of 100%; this way, if section under 100% height, wrapper ensure 1 sections shows on page. if section height on 100%, scrolling can occur on wrapper, rather on page.

How to assign a PHP variable value to JavaScript variable -

in code posting have 1 problem. want php variable stored in javascript variable shows error. code below. <?php $name="anurag singh"; echo ' <html> <head> <script type="text/javascript" src="jquery-2.0.2.js"></script> <script type="text/javascript"> $(document).ready(function(){ var name1=.$name.";" $.post("main_page.php",{input1: name1}, function(msg){ alert("hi "+msg); }); }); </script> </head> <body> <h1>this demo!</h1> <h2>in echo can add more 1 statements</h2> </body> </html> '; ?> now when assigning $name variable name1 syntax error. please let me k

knockout.js options binding not reflecting added item -

the page shows original list of advisers properly. however, when attempt use push() method array, list size updates, select option list on page not update. need tell knockout update or something? here sample code: function updatestudentadviserlist(student) { var list = viewmodel.studentadvisers(); if (student.isstudentadviser() == "true" || student.isstudentadviser() == true) { var alreadyinlist = false; (var = 0; < list.length; i++) { alert(list[i].id); if (list[i].id == student.id()) { return; } } list.push(student); alert('new size: ' + list.length); } else { (var = 0; < list.length; i++) { alert(list[i].id); if (list[i].id == student.id()) { list.splice(i, 1); alert('new size: ' + list.length); break; } } } } function viewmodel(da

c# Oracle Dynamic Connection string solution -

i have application connects specific oracle user & database data provided user through 1 little form. user inputs username, password , host address , can connect user defined locally, in oracle client's file: tnsnames.ora. works fine, have problem when designing reports devexpress (or other reports designer tool) same application. all devexpress reports communicating database tables through dataset uses fixed, hardcoded values defined in connection string in app.config. the problem can't have hardcoded values connecting database, because user can every time enter different values , connect different user on database, through little connection form, when application running. know best way deal this? i don't know, maybe replacing connection string in app.config every time when user inputs connection data? you have static connection string reports , separate 1 oracle db/user connection.

ios - Too much boiler plate code - Methods -

i have simple uiviewcontroller 9 uiimageviews . when each uiimageview pressed method (or function) called. works fine problem have boiler plate code now. in viewdidload method have 9 uitapgesturerecognizer detect when of 9 uiimageviews pressed. call method run. here code: uitapgesturerecognizer *tap1 = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(imagepressed1:)]; [picview_1 addgesturerecognizer:tap1]; uitapgesturerecognizer *tap2 = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(imagepressed2:)]; [picview_2 addgesturerecognizer:tap2]; uitapgesturerecognizer *tap3 = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(imagepressed3:)]; [picview_3 addgesturerecognizer:tap3]; uitapgesturerecognizer *tap4 = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(imagepressed4:)]; [picview_4 addgesturerecognizer:tap4]; uitapgesturerecognizer *tap5 = [[uitapgesturerecognizer alloc] initwithtarget:self

c++ - Apple LLVM 4.2 segfaults using range-based loops with references -

i'm not sure whether actual bug of llvm comes xcode 4.6.3 (4h1503) or if i'm doing not kosher. snippet of code follows for(auto &a : matrix[j]) { = false; } where matrix vector of vector s containing booleans. i've been developing visual studio 2012 while , didn't seem problem, application needs run on mac went on , tested it... , bit surprised couldn't compile. upon closer inspection, i've discovered getting full blown segfault clang itself, indication of bad shenanigans going on. isolated piece of code , changed loop more peasant's version using integer index , jazz. works charm. am correct in assuming original loop supposed working (i've seen similar things here in so, , besides vs2012 didn't have say, really) or making gross mistake , not supposed use references that? i'd know before reporting bug apple. edit #include <vector> using namespace std; int main(void) { vector<vector<bool>> matrix =

sqlite - Receive update from web server to iOS App and synchronize data -

i'm writing app manage sqlite database, , have write web server, want user register in web server username , password, know how make request ios app server , receive response, want enable synchronization of sqlite database other device, core data can use icloud synchronization, prefer use sqlite, , find way synchronize it, example want create this: make change in sqlite in iphone app; the app send change server user; then server have send update other device connected @ user; and can't go over, how server can send change other device? device has listen server? or there way send update directly device , handle it? apple push notification? edit: if it's possible use apple push notification this, doesn't want alert text sound , badge user, send "silent notification" it's possible? as high-level there few different ways approach this, of have pros , cons. 2 name 2 examples can polling method, active push or hybrid approach. polling: @

c# - Internal Implementation of AsEnumerable() in LINQ -

i have 2 questions: question 1 background : noticed when looking @ implementation of 'asenumerable()' method in linq microsoft, was: public static ienumerable<tsource> asenumerable<tsource>(this ienumerable<tsource> source) { return source; } question 1: expecting kind of casting or here , returns value passed. how work ? question 2/3 background : have been trying understand covariance , contravariance , invariant. think, have vague understanding 'in' , 'out' keywords determine polymorphic behavior when assigning subtype parent type. question 2: know reading ienumerable covariant, , list invariant why not possible : list<char> content = "teststring".asenumerable(); question 3: if ilist implements ienumerable why not possible : ienumerable<char> content1 = "teststring"; ilist<char> content2 = content1; please me understanding, thank in advance. the input argument k

r - ggplot in function using environment variables: arguments imply differing number of rows -

i have function print , save charts using ggplot. data frame being used plots has nas in of columns - subset data first (and not in ggplot). when run function first time, works (and when run code in r line-by-line , not function, works inputs). however, when try run function second time input, receive error: error in data.frame(x = c(1, 21, 41, 53, 75, 80, 87, 100), y = c(1000, : arguments imply differing number of rows: 8, 6 after research, i'm convinced i'm not calling out correct data frame somewhere in ggplot layers, , environment variable getting used instead of input variable. but, cannot pinpoint error. i've listed sample data works in function. smpl_data <- data.frame(c(2011,2011,2011,2011,2012,2012,2012,2012),c(1,21,41,53,75,80,87,100),c(1000,1100,1200,1300,950,1050,1150,1250),c(2100,na,2200,2300,2050,2150,na,2350)) names(smpl_data) <- c("year","date_rank","modws_00x_3","modws_53x_3") #the following

.net - JSON decoding: Unexpected token: StartArray -

i'm using json.net decode json string , find error: exception in 'newtonsoft.json.jsonreaderexception' en newtonsoft.json.dll información adicional: error reading string. unexpected token: startarray. path 'mentions', line 3, position 3. the json string this: { "mentions": [ { "id":"1234", "alert_id":123, "title":"bla bla bla", "url":"http:\/\/www.example.com\/", "unique_id":"123", "published_at":"2013-07-30t11:26:36.92131100+00:00", "created_at":"2013-07-30t11:27:08.0+00:00", "updated_at":"2013-07-30t11:27:09.0+00:00", "favorite":false, "trashed":false, "trashed_set_by_user":false, "read":fa

php - How can I scale an image using tcpdf? -

i've got image of size 490 x 630 drawn in corel. it's supposed have 41.3 mm (wide) , 52.3 mm . the unit i'm using in tcpdf class "mm". i'm having trouble trying acomplish this. what value should put on setimagescale() ? thanks ! i using image of format ".png". ".png" format had trouble trying display image correctly on pdf. opened image in paint , save ".jpg" , use instead. once i've changed format display image correctly without complication. think there's bug on pcdf related ".png" images.

weblogic - How do you implement ExitOnOutOfMemoryError parameter on JRockit R28? -

my weblogic servers use jrockit jvm r28. need have weblogic jvms configured automatically shutdown/kill/exit when outofmemoryerror occurs. a jrockit jvm parameter called "exitonoutofmemory" let accomplish this. oracle documentation provides incorrect , conflicting information. 1.) http://docs.oracle.com/cd/e13150_01/jrockit_jvm/jrockit/jrdocs/refman/optionxx.html says put " -xxexitonoutofmemory " startup scripts. however, jrockit doesnt "recognize" parameter. 2.) http://docs.oracle.com/cd/e15289_01/doc.40/e15062/optionxx.htm#babcdaib says put " -xx:+exitonoutofmemoryerror " startup scripts. jrockit not recognize configuration either. believe mistakenly copied hotspot documentation. how implement parameter? -xx:+exitonoutofmemoryerror works expected jrockit r28.2.2: $ jrockit-jdk1.6.0_29/bin/java -xmx20m -xx:+exitonoutofmemoryerror oom java.lang.outofmemoryerror: alloclargeobjectorarray: [b, size 40976 @ jrockit/vm/al

events - Android App on Multiple Devices -

i have been developing concept android application doctors use, , involves use of android mobile phone , tablet in operation theater. have clickwheel sort of menu on app running on phone, , instance of app running on tablet. when user selects option using wheel, event has trigger rendering of view on tablet. i'm quite new android development, on how implemented great! thanks in advance! krishna you'll have devices on same network (of sort). , device sort of communications whereby phone can send selected choice on network tablet, , tablet can react updating ui. this communication achieved in many different ways: bluetooth, or wifi think easiest 2 implement. 1 fits use case better wouldn't know without more information though.

actionscript 3 - verifying a IF condition always AS3 -

i'm beginner in as3 please if possible give point noob answer. want have specific button clicked create line, example click button need click twice on stage i click , selected i click first time on stage select starting point of line i click second time on stage select finishing point. i tried can`t manage to, if possible please me. code wrote dr_line.addeventlistener(mouseevent.click,drawln); var test:boolean; function drawln(e:mouseevent):void{ test=true; stage.addeventlistener(mouseevent.click,reportclick); } var sx,sy,fx,fy:int; var j:int; function reportclick(event:mouseevent):void { j=0; j++; if (test==true && j==1) { sx=event.localx; sy=event.localy; } j++; test=true; trace(j); trace(test); if (test==true && j==2) { fx=event.localx; fy=event.localy; j=0; test=false; var line:shape = new shape(); line.graphics.beginfill(0x00ff00

What is the correct way to perform a 301 redirect in .htaccess for URLs with a parameter? -

i simple 301 direct on old urls have parameters them. e.g. redirect 301 /display.php?id=2 http://www.url.com.au/about/ redirect 301 /display.php?id=4 http://www.url.com.au/news/ my experience .htaccess limited. simplest , correct way enable above redirects work. this should work given don't have other rules may interfere one: rewritecond %{query_string} ^id=2$ rewriterule ^display.php$ /about/ [r=301,l] rewritecond %{query_string} ^id=4$ rewriterule ^display.php$ /news/ [r=301,l] if domain not same domain may include full qualified domain in: rewritecond %{query_string} ^id=2$ rewriterule ^display.php$ http://www.url.com.au/about/ [r=301,l]

php - AJAX request callback using jQuery -

i new use of jquery handling ajax, , have written basic script basics down. posting ajax request same file, , wish additional processing based on results of ajax call. here code: **/*convertnum.php*/** $num = $_post['json']; if (isset($num)) echo $num['number'] * 2; ?> <!doctype html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <style type="text/css"> td {border:none;} </style> </head> <body> <table width="800" border="1"> <tr> <td align="center">number send<br /><input type="text" id="numsend" size="40%" style="border:2px solid black;"></td> <td align="center">number returned<br /><input type="text" id="numreturn" size="40%" readonly></td> <

postgresql - Efficiently select the most specific result from a table -

i have table follows: create table t_table ( f_userid bigint not null ,f_groupaid bigint ,f_groupbid bigint ,f_groupcid bigint ,f_itemid bigint ,f_value text ); the groups orthogonal, no hierarchy can implied beyond fact every entry in table have user id. there no uniqueness in of columns. so example simple setup might be: insert t_table values (1, null, null, null, null, 'value user 1'); insert t_table values (1, 5, 2, null, null, 'value user 1 in groupa 5 groupb 2'); insert t_table values (1, 4, null, 1, null, 'value user 1 in groupa 5 , groupc 1'); insert t_table values (2, null, null, null, null, 'value user 2'); insert t_table values (2, 1, null, null, null, 'value user 2 in groupa 1'); insert t_table values (2, 1, 3, 4, 5, 'value item 5 user 2 in groupa 1 , groupb 3 , groupc 4'); for given set of user/groupa/groupb/groupc/item want able obta

Memory Error in PHP Using SQL Query -

i have php page has search box , searches media large database. have made if put first 3 characters (e.g. v75) v75 tapes shown (v75000, v75001, etc.). when search v7 gives me error: fatal error: allowed memory size of 268435456 bytes exhausted (tried allocate 47 bytes) on line 68 $query->execute(); // line 66 $result = $query->fetchall(pdo::fetch_assoc); // line 68 }catch (exception $e) // line 69 { die('cant fetch rows.'); // line 70 i wondering must change display v7 tapes well? approximate number of 'v7' tapes 255000 note that, if set php memory limit higher allow many results, sending more 256 mb user search query make request terribly slow if doesn't time out. use sort of pagination , limit queries.

python compute closeness of strings -

i want compare string representations of 3 or 4 digit integers. want group them pairs of 'closeness'. is, pc_dud[3] should pair dud[0] . dud = ['3433', '3467', '3551', '345', '345', '3613'] pc_dud = ['3401', '3402', '3430', '0342', '3584'] does know of tool out there (i thinking myself maybe jellyfish)? solution of course use arithmetical difference indicator 'closeness'. thoughts? you can use difflib module: example: >>> import difflib >>> dud = ['3433', '3467', '3551', '345', '345', '3613'] >>> pc_dud = ['3401', '3402', '3430', '0342', '3584'] >>> difflib.get_close_matches(dud[0], pc_dud) ['3430']

java - how to put two jpanels side by side -

i try put 2 jpanels side side, in moment can not want have code, this.videopanel= new jpanel(); this.videopanel.setbackground(new color(102, 102, 102)); this.videopanel.setpreferredsize(new dimension(320, 240)); this.videopanel.setlayout(new boxlayout(this.videopanel, 1)); grouplayout layout = new grouplayout(getcontentpane()); getcontentpane().setlayout(layout); layout.sethorizontalgroup( layout.createsequentialgroup() .addgroup(layout.createparallelgroup(grouplayout.alignment.leading) .addcomponent(this.videopanel, 10, 400, 500))); layout.setverticalgroup( layout.createsequentialgroup() .addgroup(layout.createparallelgroup(grouplayout.alignment.baseline) .addcomponent(this.videopanel, 10, 400, 500))); pack(); ` try put 1 more jpanel: this.videopanel1.setbackground(new color(102, 102, 102)); this.videopanel1.setpreferredsize(new dimension(320, 240)); this.videopanel1.setlayout(new boxlayout(this.videopanel1, 2)); group

geolocation - Google+ API : Get Profile's currentLocation -

i'm building test , trying google+ user location. i'm testing on myself , have set position public. i planning use google latitude, however, since google deprecating api in few days, option use google+ api. the parameter currentlocation added few months ago i'm therefore trying it. not manage it. i've tested on own server using php api , js api oauth2.0, damn parameter never sent back. can other parameter not one. then i've tested in google+ explorer, same thing here, nothing came out does have encounter similar issue ? i have few idea come : does oauth2.0 not let me access information (i've tried possible data-scope) is there bug on functionality ? is restricted verified users ? or maybe it's not possible ? thanks ! access location data restricted users have granted access location data @ time oauth token generated. you have request access location data in scope parameter.

Excel VBA snapping back my space bar action -

this weird question, not formulate question in google. when write comments in excel-vba, reason snaps cursor on space bar hits. example: dim arr() string 'this |<-- when hit space bar, expect cursor here. but if not quick enough, snaps 'this is|<-- here this bothering me because have go , forth in putting spaces in lines of text space-less. some behavior: when type fast, think able overshoot(?) replacement, , doesn't snap back, if go slowly, faster me. also, if hit space, snaps back, hit space, moves cursor, , after 0.5 second delay snaps again. i have excel 2010. anyone else had same issue, or know how fix it? isn't big thing, annoying. turn on design mode in developer tab.

php - Laravel live server won't work with eager loading -

i've got code has been working fine on local machine (wamp, php 5.4.3) not on production server (centos, php 5.4.11) , can't see why, offending line of code is: $sharedlist = sharedlist::with('itemlist') ->where('unique_url', '=', $uniqueurl) ->first(); if remove with() eager loading runs without issue, if don't (and don't need on local machine) this: argument 2 passed illuminate\database\eloquent\relations\belongsto::match() must instance of illuminate\database\eloquent\collection, instance of itemlist given, called in /home/mgc/public_html/test/vendor/laravel/framework /src/illuminate/database/eloquent/builder.php on line 474 , defined /home/site/public_html/test/vendor/laravel/framework/src/illuminate/database/eloquent/relations/belongsto.php line 154: public function match(array $models, collection $results, $relation) the relevant relationship info sharedlist model is

asp.net - How to Handle Concurrent sessions in .Net C# -

i working on application saving member's (not logged in user) information in session. that specific id used take payments , other things well. however, when open 2 tabs of application or 2 windows of application; member's session id mismatches. current tab picks id of secondary tab opened. i request guidance/help. i using following code: public static object getsessionvalue(string sessionname) { if (httpcontext.current.session[sessionname] == null) { return null; } else { return httpcontext.current.session[sessionname]; } } public static void setsessionvalue(string sessionname, object sessionvalue) { httpcontext.current.session[sessionname] = sessionvalue; } however, when open 2 tabs of application or 2 windows of application; member's session id mismatches. current tab picks id of secondary tab opened. if open same website in 2 different tab of browser, share session. design. you can replicate it. login bank

javascript nested callback-functions return -

how can return value evt.target.result function? or there way better? thanks lot function datei_lesen(datei){ filesystem.root.getfile(datei, null, function(fileentry){ fileentry.file(function(file){ var reader = new filereader(); reader.onloadend = function(evt) { return evt.target.result; }; reader.readastext(file); }, function (evt) { alert("2:"+evt.target.error.code); }); }, function (evt) { alert("1:"+evt.target.error.code); }); } no ideas here? otherwise have use global variables

javascript - Why is document.getElementById considered an object in IE8 -

Image
i noticed document.getelementbyid function in firefox , chrome, while typeof considers object in ie8 (at least). anyone has idea why? ie8 (attempts to) implement ecmascript 3 typeof operator result implementation defined host objects regardless if object implements [[call]]. in es5, callable host objects must return "function" . see table in ecmascript 3 compare ecmascript 5.1 http://www.ecma-international.org/ecma-262/5.1/#sec-11.4.3

java - Is it possible to log in to google services via Oauth 2 on the server-side without browser? -

i'd use google universal analytics api on server side. idea there browser app showing graphs open intranet , doesn't require login @ all. server either login client , provides working token client or server provides data client well. oauth login docs , libs google rely on redirect urls etc sounds painful server-side login . possible , there tutorials?

PHP/Mysql authentication script getting NULL result from query -

i working on test project, trying learn more php , mysql , not. have decided build authentication engine test website having issues query. basically, if run... select * users name="tester" , passwd=md5('pass'); from mysql console, get... +--------+---------------+----------------------------------+ | name | email | passwd | +--------+---------------+----------------------------------+ | tester | test@test.com | 1a1dc91c907325c69271ddf0c944bc72 | +--------+---------------+----------------------------------+ 1 row in set (0.00 sec) however,when issue same query (at least think same) php code (see below) appear getting null result, authentication fails. <?php include 'db_connect.php'; $username = $_post['username']; $passwd = $_post['passwd']; // protect mysql injection (more detail mysql injection) //$username = stripslashes($username); //$passwd = stripslashes($pas

php - If only 1 field out of 4 is available -

i using below code on wp site. <?php $images = array(); $images[] = $profile_user->banner_image_1; $images[] = $profile_user->banner_image_2; $images[] = $profile_user->banner_image_3; $images[] = $profile_user->banner_image_4; if(!empty($images[0]) || !empty($images[1])|| !empty($images[2])|| !empty($images[3])){ ?> <?php echo '<div class="slider2">'; ?> <?php foreach($images $img): ?> <?php if(!empty($img)): ?> <div> <img src=" <?php $image_id = $img; $post_image_data = wp_get_attachment_image_src( $image_id, $size='profile_banner_img' ); echo $post_image_data[0]; ?>" /> </div> <?php endif; ?> <?php endforeach; ?> <?php echo '</div>'; ?> <?php } ?&g

Is h5py capable of converting python dictionaries to hdf5 groups automatically? -

i have been using scipy.io save structured data (lists , dictionaries filled ndarrays in different shapes). since v7.3 mat file going replace old v7 mat format day, thinking switching hdf5 store data, more h5py python. however, noticed cannot save dictionaries easy as: import scipy.io sio data = {'data': 'complicated structure data'} sio.savemat('filename.mat', data) instead, have use h5py.create_group 1 one replicated structure in python dictionary. large structures, unfeasible. there easy way automatically convert python dictionaries hdf5 groups? thank you! -shawn i needed kind of thing time, , decided neat make hdf5 version of pickle: https://github.com/telegraphic/hickle the motivation storing python dictionaries of numpy arrays, sounds you're after: import hickle hkl import numpy np data = { 'dataset1' : np.zeros((100,100)), 'dataset2' : np.random.random((100,100)) } hkl.dump(data, 'ou

php - Global connection variable or new one every time -

i'm thinking of creating global variable $pdo use along script inside classes , functions , code . there security breach can occur upon ? i'm using seperate connection every time . shall stick or use global pdo object ? this depends on application, there cases want manage multiple connections. however, in many cases, makes sense open single connection use during course of processing single request. helps eliminate overhead of opening/closing connections throughout code. guess security not of concern in cases unless planning on handing off db connection set of code should not have db permissions associated specific connection (maybe library or service not control). i highly suggest concept of dependency injection, in cases preferable pass around instantiated db object pieces of code need rather treat global , use global keyword access it. helps avoid needing replicate code in every class/function check db has connection , such. if have single class , can

c# - Linking two forms together -

i wondering if possible persay 'link' 2 winforms in c#. in way can call variables like: applicationproperties.applicationport.baudrate instead of having make instance want call? similar vb.net. if point me in right direction appriciated. i have 2 forms(mainbox) , (applicationproperties). have both form accessable eachother. in way similar vb.net. ex: in form 1 have serial port (applicationport), , writing values .xml file. public void saveapplicationproperties() { try { //createnode(everything being referenced. put text boxes, , drop down boxes here. xmltextwriter writer = new xmltextwriter(@"c:\fortesenderv2.0\properties.xml", system.text.encoding.utf8); writer.writestartdocument(true); //making code indeted 2 characters. writer.formatting = formatting.indented; writer.indentation = 2; //making start element "table". writer.

How to get getopt.getopt in python -

my python script this: def main(argv): print argv try: opts, args = getopt.getopt(argv,"h",["help"]) print opts print args opt, arg in opts: print opt but when run it, see opts empty. ./myscript.py debug.lst -s 0 -e 1 ['debug.lst', '-s', '0', '-e', '1'] [] ['debug.lst', '-s', '0', '-e', '1'] do have idea how work? as the docs say: note unlike gnu getopt() , after non-option argument, further arguments considered non-options. similar way non-gnu unix systems work. so, should expect. if want gnu-style parsing instead of traditional unix-style parsing, use gnu_getopt . or, better, use argparse instead of getopt . reasons ever use getopt (a) know getopt of hand , don't want learn new, or (b) you're porting or maintaining code (possibly c or language) uses getopt . neither of these applies here. d

javascript - AngularJS Directive Object Has "No Method" -

i moving around code in angularjs app , have started receive error on customer directive. directive works fine in original, returning error listed below after i've moved few things. i have been working through code try , find reference missed, file version off, or other reason why error popping up. i've unfortunately not found anything. what might causing following error occur on angularjs directive? typeerror: object [object object] has no method 'slider' @ link (http://localhost:8000/static/modeling/js/directives/slider.js:9:13) @ k (http://localhost:8000/static/js/angular.min.js:44:444) @ e (http://localhost:8000/static/js/angular.min.js:40:139) @ e (http://localhost:8000/static/js/angular.min.js:40:156) @ e (http://localhost:8000/static/js/angular.min.js:40:156) @ e (http://localhost:8000/static/js/angular.min.js:40:156) @ k (http://localhost:8000/static/js/angular.min.js:44:382) @ e (http://localhost:8000/static/js/angular.min.js

Is there a way to monitor a Windows service and alert people when it hangs/stops? -

we have service running on windows server 2003 machine. service watches particular folder on ftp server, , when files appear there, invokes 1 of few different executables process them. i've been asked find way staff alerted in way when service hangs or stops. can suggest information? if not, else need know? seems write service watch service, there's chance 1 stop ... haven't resolved anything. about thing know if writing application or service monitors if service running; shouldn't have unexpected behavior , stop, hopefully. another thing go service in windows, go properties, , go recovery options. here, can set behavior of service if fail. options in windows 7 restart service or computer, or run program. program send sort of notification. however, don't know if or of these options exist in server 2003. not work if service hang, service watching wouldn't either. also, if have source code, can override of service-related methods such onst

javascript - How to filter my data? (ng-grid) -

i think simple cannot find clear documentation on how add filter outside of 'filtertext' shown on website. trying simple this: $scope.filteroptions = { filter: $scope.myfilter, // <- how this? useexternalfilter: true } $scope.gridoptions = { data: 'entries', enablecolumnresize: false, multiselect: false, enablesorting: false, selecteditems: $scope.selectedentries, filteroptions: $scope.filteroptions } $scope.lowerlimit = 50; // filter $scope.myfilter = function(entry) { if (entry < $scope.lowerlimit) { return false; } return true; } edit: or maybe if filter datasource somehow? tried this: $scope.gridoptions = { data: 'entries | filter: myfilter', enablecolumnresize: false, multiselect: false, enablesorting: false, selecteditems: $scope.selectedentries, } but throwing quite few errors. you can use angular bind filte

c# - Property that changes in constructor or as property -

i working c# using mvvm pattern. have 2 wpf windows, each view model. need pass property of main view model 'child' view model. @ minute, setting private variable equal new view model in main view model's constructor, , in doing passing property in constructor of child view model. however, there dependency property linked property used binding selected item in combobox. therefore, change after child view model initialized, passing property in constructor, change not made in child view model. so, there anyway me pass property constructor , have change in child view model when in main view model? or have create property in child view model updated everytime property in main view model set? hope makes sense. edit inside main view model, declare following: public readonly dependencyproperty currentdatabasemanagedproperty = dependencyproperty.register("currentdatabasemanaged", typeof(databaseinfo), typeof(mainviewmodel)); public databaseinfo currentdatab

hadoop - extracting non-matching records between files in Pig Latin -

i beginner, learning pig latin. need extract records file. have created 2 files t1 , t2, tuples common both files, need extract tuples present in t1 , need omit common tuples between t1 & t2. can please me... thanks firstly you'll want take @ this venn diagram . want middle bit. first need full outer join on data. then, since nulls created in outer join when key not common, want filter result of join contain lines have 1 null (the non-intersecting part of venn diagram). this how in pig script: -- t1 , t2 2 sets of tuples using, schemas are: -- t1: {t: (num1: int, num2: int)} -- t2: {t: (num1: int, num2: int)} -- yours different, principle same b = join t1 t full, t2 t ; c = filter b t1::t null or t2::t null ; d = foreach c generate (t1::t not null? t1::t : a2::t) ; walking through steps using sample input: t1: t2: (1,2) (4,5) (3,4) (1,2) b full outer join resulting in: b: {t1::t: (num1: int,num2: int),t2::t: (num1: int,num2: int)} ((

Android layout vs. custom view -

Image
i want generate following android application. i tried achieve using relativelayout , drawables (empty circle, filled circle, dotted line) created using xml , not close it. right way generate such views layouts. if so, relativelayout way go? or should create custom view that? why there 4 dots between last item , 1 before it, while other have 3 dots? anyway, think can achieve results having listview custom items. each item shown relativelayout 2 imageviews (one below other) , textview on right of upper one. the upper imageview have large dot (filled or not), optional dots above it, , imageview below stretch size according textview (align bottom plus add more small-dots) , have tiled dots background. another approach have listview of textviews , imageview on left, , draw circles according listview showing (even while scrolling). it's harder, might more precise.

java - Polymorphic deserialization in Jackson based on ints, not strings -

normally, when doing polymorphic deserialization jackson, have string field maps class, , can this. @jsontypeinfo( use = jsontypeinfo.id.name, include = jsontypeinfo.as.property, property = "methodname") @jsonsubtypes({ @jsonsubtypes.type(value = myfirstclass.class, name = "firstclassname"), @jsonsubtypes.type(value = mysecondclass.class, name = "secondclassname")}) i can't find easy example of how if value integer, rather string. instance, how pick class deserialize if instead of "methodname":"firstclassname" json included "methodname":1? there no 'easy' way of doing that. have write own implementation of serialization mechanicsm, , 1 deserialization. perils of such implementation many you'd better off quoting typeinfo property , using string.

linux - NTP does not handle restrict on pool server correctly -

if running ntp (via ntp.conf) heavily restricted, cannot use pool server. why? because call restrict (to allow access pool) seems dns lookup, returns ip value used call server. please show me wrong/being stupid this. crude example (portion of ntp.conf): server 0.debian.pool.ntp.org iburst restrict default ignore restrict -6 default ignore restrict 0.debian.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery this not work (i think) because dns calls 0.debian.pool.ntp.org return different ip addresses , wrong ip address allowed via (poorly named) restrict. use builtin source alias/directive/whatever: restrict source nomodify notrap noquery updatedd include documentation source : restrict source configures template restriction automatically added @ runtime each association, whether configured, ephemeral, or preemptible, , removed when association demobilized. from: http://www.eecis.udel.edu/~mills/ntp/html/accopt.html#restrict

c# - Asp.Net method that work for automatic file Upload -

i using fileupload on asp.net c# page , button upload browsed picture. if file being uploaded qualify validation saved , instantly shown in asp.net image below upload button. made alot of search find out asp.net fileupload control autopostback method not find. problem having when user click upload button , when page rendered values in textboxes disappear , page go top. want task using ajax cannot fileupload has no autopostback event. can give me idea or alternative way of doing this. method usisng user not require upload button. thanks you must full postback fileupload control , since not designed asynchronous postback. look under using fileupload control in partial-page updates in msdn fileupload web server control but try using iframe , <input type="file"/> in example: create ajax style file upload there ajaxfileupload control asp.net control toolkit : http://www.asp.net/ajaxlibrary/ajaxcontroltoolkitsamplesite/ajaxfileupload/ajaxfileupload.asp

objective c - UITextField in UITableView: setting the first responder view of the table but we don't know its type (cell/header/footer) -

i have uitextfield inside of uitableviewcell, , want detect when user begins typing inside of uitextfield. set uitextfields delegate, when code runs, warning 'setting first responder view of table don't know type (cell/header/footer)' , uitextfield delegate methods dont called. how can uitextfield methods called? -(void)tableview:(id)view willdisplaycell:(uitableviewcell *)cell forrowatindexpath:(nsindexpath *)indexpath { if ((indexpath.section == 0) && (indexpath.row == 3)) { uitapgesturerecognizer *tap = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(friendcelltapped)]; [tap setnumberoftapsrequired:1]; [cell addgesturerecognizer:tap]; } else if ((indexpath.section == 0) && (indexpath.row == 4)) { nslog(@"im called"); uitextfield *tagbox = [[uitextfield alloc] initwithframe:cgrectmake(50, 6, 225, 25)]; [tagbox setborderstyle:uitextborderstyleroundedrect];

php - How to run Laravel artisan command on AppFog? -

how run artisan command on laravel app in appfog? i need run commands this: php artisan down php artisan any idea? it looks can run artisan commands within app code, this: artisan::call('down'); reference: laravel forums

css - bootstrap navbar to animate up instead of down when collapse -

i have main nav fixed on bottom of page , want navbar animate when clicked on instead of animate down. can please me out or send me in right direction? not dropdown menu know how make dropdown menu drop up. when width size turns dropdown menu , animate top when clicked on instead of bottom. great thank you. is looking for? old bootstrap 2.3.0: http://jsfiddle.net/zalog/apx5n/77/ .navbar-fixed-top, .navbar-fixed-bottom { position: fixed; } latest bootstrap 3.2.0: http://jsfiddle.net/zalog/xc7a5/ in latest version of bootstrap, default functionality.

format Resultset in Java -

i need format resultset jdbc, is there readymade package use, http://jena.apache.org/documentation/javadoc/arq/com/hp/hpl/jena/query/resultsetformatter.html i see in above website not sure how jar files package mysql.first; import com.hp.hpl.jena.*; import java.sql.connection; import java.sql.drivermanager; import java.sql.preparedstatement; import java.sql.resultset; import java.sql.sqlexception; import java.sql.statement; import java.util.date; public class mysqlaccess { private connection connect = null; private statement statement = null; private preparedstatement preparedstatement = null; private int dmlresultset = 0; private resultset ddlresultset = null; public static void main(string[] args) throws exception { mysqlaccess dao = new mysqlaccess(); //dao.readdatabase(); dao.createtemptable(); } public void createtemptable() throws exception{ try { // load mysql driver, each db has own driver clas

java - How to update reference object in Spring-data rest? -

example: class course , teacher having many-to-one relationship, how change teacher course via spring-data rest? get http://localhost:7070/study-spring-data/course/2 response: { "name" : "csci-338 hardcore java", "_links" : [ { "rel" : "course.course.teacher", "href" : "http://localhost:7070/study-spring-data/course/2/teacher" }, { "rel" : "self", "href" : "http://localhost:7070/study-spring-data/course/2" } ] } http://localhost:7070/study-spring-data/course/2/teacher response: { "_links" : [ { "rel" : "course.course.teacher", "href" : "http://localhost:7070/study-spring-data/course/2/teacher/1" } ] } as above shown, course 2 associated teacher 1, how change teacher teacher 2? i have tried: successfully updated course name: put http://localhost:7070/study-spring-data/co

ruby on rails - Filtered Pagination with Kaminari -

i set website uses ajax-pagination powered kaminari . have set simple filtering , searching, can browse list on http://example.com/products/filter?query=blah . i'm using kaminari's built-in link_to_next_page helper generate next-page link. problem comes because generated link ignores queries/filters, sending on http://example.com/products/filter?query=blah http://example.com/products?page=2 one solution i've toyed rewrite link_to_next_page helper include filters , search-terms, (as things) more work expected. there better way? according link_to_next_page document, should query_string env, keep query parameter def link_to_next_page(scope, name, options = {}) params = options.delete(:params) ||(rack::utils.parse_query(env['query_string']).symbolize_keys rescue {}) if not work expect, can pass params yourself <%= link_to_next_page @items, 'next page', :params => params %>

c# - I'm trying to edit a datatable on a SQL server and i keep getting an error about either not accepting a keyword or not connecting due to a timeout -

i need able view table , select row table , edit field in row project i'm working on. right i'm using proof of concept program figure out how works can implement real thing. first error server not recognizing keyword "provider" protected void changebutton_click(object sender, eventargs e) { using (sqlconnection conn = new sqlconnection(system.configuration.configurationmanager.connectionstrings["connectionstring"].connectionstring)) { sqlcommand cmd = new sqlcommand(); cmd.connection = conn; cmd.commandtext = "update devtesting set teststr = @teststr, teststr2 = @teststr2, teststr3 = @teststr3, testnum = @testnum personid = @personid"; cmd.commandtype = commandtype.text; string strpersonid = gridview1.rows[1].cells[1].text; string strteststr1 = "aerhtsm"; cmd.parameters.add("@teststr", sqldbtype.nvarchar, 50).value = strteststr1; conn.open();