Posts

port - TcpListener perform code after accepting a SYN packet in C# -

i'm creating "port honey pot" in c#. listens clients tcp server: tcplistener.accepttcpclient(); the code keeps on running after client connects server. however, want server perform code after accepting syn packet. is possible? there other tcp server implementation allows it? to knowledge c# tcp sockets not give access packet descriptors such syn. cannot open port in promiscuous mode. you should open udp socket, instead or take @ libraries lidgren. but then, again, won't able switch udp tcp, have 1 or other. maybe if explain why , need there other ways.

javascript - AngularJs - ng-disabled -

i have following 2 input fields. difference ng-disabled directive. so, there repetition of code.i looking forward use 1 input tag fulfilling both purposes. how can combine these 2 inputs showing/hiding ng-disabled directive based on condition? <input type="radio" name="student_role" ng-model="student.roleid" /> <input type="radio" name="role" ng-disabled="loggedstudent == student.student.email" ng-model="student.roleid" /> just try <input type="radio" name="role" ng-disabled="(loggedstudent == student.student.email) ? true : false" ng-model="student.roleid" />

swift - Drawing on UIImage in UIScrollView -

the problem this going sound crazy. i'm making drawing app , want users able draw on images bigger or smaller screen. when user selects image photo library put image view in scroll view. user draws on image views same dimensions selected image , in scroll view on top of other one. scrolling of 2 scroll views synchronized when draw scroll drawing appears above image (in right place). reason however, when user selects long image (let's 400 x 2000), drawing works @ top of image, when scroll down draw, lines draw go top. can't figure out what's going wrong... code below. about code camerastill image view containing image drawable height of image myscroll scroll view image mainimageview , tempimageview , undo1 , undo2 , undo3 drawing layers drawscroll scroll view drawing layers image selection func imagepickercontroller(picker: uiimagepickercontroller, didfinishpickingimage image: uiimage!, editinginfo: [nsobject : anyobject]!) { self.dismi...

Magento Upgrading Magento 1.3 to 1.4 Class 'File' not found Cache.php -

upgrading magento 1.3 ( using full package -> overwrite ) . fatal error: class 'file' not found in /home/www/r2h/mysite.net/public/lib/zend/cache.php on line 153 something cache guess..? have cleared apc , there no file in /app/etc delete clears cache. i'm bit baffled now.? :-) magento 1.4 , newer works bit different on clearing cache. that file named cache.ser (i think that's name) no longer exists , function has been moved core_cache_option table in database. turn off cache in database. to manually clear magento cache, delete subdirectories in app/var/cache .

php - Making this into a cron job? -

found lovely piece of sql query code excluded multiple images on magento. update catalog_product_entity_media_gallery_value set disabled = 0; update catalog_product_entity_media_gallery_value mgv, (select entity_id, count(*) image_count, max(value_id) value_id catalog_product_entity_media_gallery mg group entity_id having image_count = 2) mg set mgv.disabled = 1 mgv.value_id = mg.value_id i looking have run cron job instead of direct database have no idea how write one. can made cron job? point me in right direction please. using command line tool comes databases wrap these statements in script, this, using mysql /path/to/mysql --whateverparametersyouneed yourdb << here update catalog_product_entity_media_gallery_value set disabled = 0; update catalog_product_entity_media_gallery_value mgv, (select entity_id, count(*) image_count, max(value_id) value_id catalog_product_entity_media_gallery mg group entity_id having image_count = 2) mg set ...

How to convert pdf into text file using itext liberary -

below code converting pdf file text file. code runs, doesn't generate resulting text file (sample.txt). can shed light on this? code partly based on example of first itext in action book... import com.lowagie.text.*; import com.lowagie.text.pdf.*; public class convertpdftotext { public static void main(string[] args) throws ioexception { try { document document = new document(); document.open(); pdfreader reader = new pdfreader("data dictinary a4.pdf"); pdfdictionary dictionary = reader.getpagen(1); prindirectreference reference = (prindirectreference) dictionary.get(pdfname.contents); prstream stream = (prstream) pdfreader.getpdfobject(reference); byte[] bytes = pdfreader.getstreambytes(stream); prtokeniser tokenizer = new prtokeniser(bytes); fileoutputstream fos=new fileoutputstream("sample.txt"); stringbuffer ...

c# - Collapsed Grid in StackPanel change position of other controls in StackPanel -

i have xaml page: <stackpanel orientation="horizontal"> <grid x:name="inkgrid0" margin="0,0,0,0" horizontalalignment="left" > <canvas x:name="inkcanvas0" width="570"> <canvas.background> <imagebrush x:name="dimage0" imagesource="{binding}"/> </canvas.background> </canvas> </grid> <grid x:name="inkgrid1" margin="0,0,0,0" horizontalalignment="right" > <canvas x:name="inkcanvas1" width="570"> <canvas.background> <imagebrush x:name="dimage1" imagesource="{binding}"/> </canvas.background> ...