Posts

Showing posts from August, 2015

objective c - ipad programming guidance -

i'm @ startup level in ipad/iphone programming. there project in mind, need guidance on key points: fundemental requirements: 1)user interface , interaction wired magazine app(playing movies on page,etc) 2)accessing timeuser spent on pages , videos more: -accessing application's data (and let's application can give permission, if there so) maybe these easy things figure out, if point me pleased. ps: have more 10+ top seller ebooks on ipad/ios/iphone programming , i'm started reading them. clear, names of these concepts (in way should research accessing time user spent on page- did try on google on own words not desired result)or material pointing issues ease way. the ui portion of question should pretty easy to, take learning lot of cocoa touch library, bit of core foundation. there 2 books highly recommend: programming ios 4 iphone programming: big nerd ranch i recommend programming ios 4, because has been updated xcode 4. to answer othe...

ex - Vim command for "edit a copy of this file" -

a pattern seem following right is: edit file until it :w another-file use starting point another-file :e another-file polish another-file is there existing ex command latter 2 steps @ once? :writeandedit another-file ? i can fake 1 using vimscript, want know if there's existing command. could :saveas job? :sav[eas][!] [++opt] {file} save current buffer under name {file} , set filename of current buffer {file}. previous name used alternate file name.

iphone - UITableView adding cells dynamically -

i have uitableview in nib file , dynamically add content each of cells in tableview. there way this? have array of text display in tableview array of pictures. you need implement uitableviewdatasource protocol , override the - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath and - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section methods. want return length of array tableview:numberofrowsinsection: method. in tableview:cellforrowatindexpath: method create uitableviewcell (dequeue 1 if available) , add uiview s want hold data (i.e. uiimage, etc.). access data populate view using indexpath.row index array(s). make sense? sounds bit more complicated in practice. here documentation uitableviewdatasource protocol

javascript - Printing ZPL (txt) from browser (Coldfusion scripted) -

we have developed webshop using coldfusion. adding new functionality printing labels on internet. what happens, or rather should happen is: the customer logs in @ shop , selects order print labels. our coldfusion code creates label use of native zpl language: label saved on server plain text file zpl instructions. javascript used open text file in new window. the problem is: printing text file browser doesn't work. not when set printing not show additional header , footer details. when request source code , print it, labels printed. have tested on ie9 , ff7. so questions are: is way use javascript send plain text printer, without html mark up? came across javascript code embeds text html mark , using window.print() command. not option. or there way make printing of plain text file out browser work properly? thank attention! if service limited windows users, can have them install ups activex control direct zpl code connected thermal printer. ups thermal...

Scroll event of big-size items within Android ListView -

i have listview containing big-sized items. each item may occupy more 1 screen. objective calculate offset (view.gettop()) of first visible item on screen. i use setonscrolllistener capture scrolling event. problem onscroll event triggered when visible item changed. if 1 item vertically spanned bigger screen size, onscroll event not triggered during scrolling of big item. is there other event capture achieve objective? thanks

css - Strange Chrome behavior: calculates all margin percentages right except for margin-top! -

when declare style div: #fbinner{ position: absolute; margin: 11.2% 9.7% 0% 26.4%; width: 63.5%; height: 54.6%; overflow: visible; /*max-height: 190px; max-width: 490px;*/ font-size: 11px; font-family: "lucida grande",tahoma,verdana,arial,sans-serif; color: #fff; /*border: solid 2px gray;*/ } chrome sets every margin right except of margin top, set smaller in other browsers ... strange, other margins displayed should ... what reason that? there workaround still uses percentages? seeing x-browser css question, resetting css styles valuable first step - maybe solution. haven't disclosed html code, can't know other tags or styles affecting #fbinner in case, here "meyerweb reset" stylesheet: http://meyerweb.com/eric/tools/css/reset/ link topmost in html file. break site, that's thing. @ least should equally broken in browsers now. when you've fixed of page, should work in most/all browser...

python - How to check if end of list was reached? -

if have list, a=[1,2,3] , , want see if a[4] null , there way that, without using exception or assertion? len tell length of list. quote docs: len(s)     return length (the number of items) of object. argument may sequence     (string, tuple or list) or mapping (dictionary). of course, if want final element in list , tuple , or string , since indexes 0 based, , length of item element count, a[len(a)-1] last item. as aside, generally, proper way access last element in object allows numeric indexing (str, list, tuple, etc) using a[-1] . obviously, not involve len though.

Rails 3 w/ Devise/CanCan: POST/PUT Request Fails when loading the user? -

i running functional tests test::unit against rails 3 application uses devise , cancan manage users. however, hitting weird issue in requests when make post or put contacts_controller. request fails when controller loads user database, , stops, results in failed test. would have idea of why occurring? console output sql (2.8ms) describe `roles_users` sql (2.1ms) describe `camps_users` sql (3.4ms) describe `camps_users` sql (2.0ms) describe `campers_camps` sql (2.8ms) describe `campers_camps` sql (2.1ms) describe `roles_users` loaded suite test/functional/camp/contacts_controller_test started sql (0.1ms) begin sql (0.7ms) show tables user load (0.3ms) select `users`.* `users` (`users`.`id` = 292811013) limit 1 sql (0.4ms) select count(*) `contacts` camp load (0.3ms) select `camps`.* `camps` (`camps`.`id` = 665138414) limit 1 processing camp::contactscontroller#create html parameters: {"contact"=>{"first_name"=>"john"...

using Microsoft Sql Server SMO to get relations in both direction -

how can query table related tables in both direction using smo for example table employee ..... jobid int null -- fk table job jobid int not null -- pk using kind of generating tool ms t4 template, , smo; want reach following classes class employee { ...... public int? job_id { { return _job_id; } set { if (_job_id!= value) { if (job != null && job.jobid != value) //the problem here (i cannot related pk related table) { job = null; } _job_id= value; } } } private int? _job_id; job thejob {get; set;} } class job { ..... icollection<employee> employees { ..... } } here how related tables public arraylist getchildren(table tbl, server server) { var result = new arraylist(); dependencywalker w = new dependencywalker(server); dependencytree tree = w.discoverdependencies(new sqlsmoobject[]{tbl}, ...

php - Using cURL - maintain cookies & sessions, etc -

say make request log site, using curl. $ch = curl_init(); curl_setopt($ch, curlopt_url, $urls["sign_in"]); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_cookiejar, "cj.txt"); curl_setopt($ch, curlopt_cookiefile, "cj.txt"); curl_setopt($ch, curlopt_post, true); curl_setopt($ch, curlopt_postfields, $pdata); curl_setopt($ch, curlopt_followlocation, true); curl_setopt($ch, curlopt_referer, $urls["home"]); curl_exec($ch); curl_close($ch); now, make request page. how can keep same sessions & cookies had (in previous code) alive in next request? tried this, not working: $ch = curl_init(); curl_setopt($ch, curlopt_url, $urls["enter"]); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_cookiejar, "cj.txt"); curl_setopt($ch, curlopt_cookiefile, "cj.txt"); curl_setopt($ch, curlopt_followlocation, true); curl_setopt($ch, curlopt_referer, $urls["home"]); $d...

SharePoint 2010 "foreach" -

i have 2 sharepoint lists, , have copy items list1 list2. on list1 there boolean field (defaults 'no'), text field , associated workflow triggers on modifications. the wokflow simplified: copy current item list2 set boolen field 'yes' search item boolen field 'no', set text field 'copy' i start process modifing item in list1, copy list2, modifies item, , on... until there item boolen field set 'no'. this works 10 items, fails. item 10 modified item 11's text field 'copy', item 11's workflow not started. i've tried serval times, , stopped after 10 copies. i've googled , msdn'd. best solution i've found pause 1 minute in workflow. have thousands of items... has advice? cant find limit in sharepoint 2010 server defaults 10. thank you! you triggering hardcoded resource throttle in sharepoint 2010 due speed on workflow. it's there prevent system becoming unresponsive during workflow ...

c# - Does encapsulating one CryptoStream in several others improve security? -

i'm working on project windows phone 7 stores highly secure information. data protected password. if encrypt 1 cryptostream within 3 other cryptostreams (a total of 4 cryptostreams embedded in each other, each using different methods generate key, initialization vector, , salt). method secure enough, or need more cryptostreams (each 1 uses 256 bit aes encryption)? it far more brute force or socially engineer password crack singly-encrypted stream since password have smaller bitspace key. encrypting multiple times increase time or effort required brute force password o(n) (you want complexity increase o(n^2) or more). but if need super-secure encryption, don't roll own strategy, pick dod standard (or equivalent) , implement it. to explain further, aes block cipher 3 different key lengths. first part of strategy determining key length want use. pick 1 @ random, or pick largest, want pick best choice situation. next actual usage of aes. since it's bloc...

c# - How to Implement concurrency in NHibernate -

i have 2 person , persondto classes , i'm using nhibernate save these objects. while have 1 user there no problem , user going update object user updating it. both of can update same object , because updated user, on of changes lost. in order implement cuncurrency used 2 ways both of them faced problem. the first solution : use person constructor update object the second approach : using getbyid method the first approach working great problem unfortunately don't have enough permition load person completetly dependencies. have use second approach. in second approach when set (update) version o last second, nhibernate using old version changes won't apply. look @ following code load person id person = locator.personrepository.getbyid(dto.id); version field loaded new value. need set persondto object person.version = dto.version during update process nhibernate passes old value sql , don't face concurreny error. what should implement...

ruby - SMTP settings using Godaddy mail with Rails 3 -

how should set smtp settings in initializer file using godaddy mail? shamelessly taken article here: http://pilotoutlook.wordpress.com/2008/10/13/setup-email-in-ruby-on-rails-using-godaddysmtp/ open root/config/environment.rb file sendmail, add following lines - actionmailer::base.delivery_method = :sendmail actionmailer::base.smtp_settings = { :domain => ‘www.example.com’ } for godaddy, add following lines - actionmailer::base.delivery_method = :smtp actionmailer::base.smtp_settings = { :address => ‘smtpout.secureserver.net’, :domain => ‘www.example.com’, :port => 80, :user_name => ‘johndoe@example.com’, :password => ‘yourpassword’, :authentication => :plain } save , restart webserver. set. remember can send 300 emails per day godaddy, if need send more emails, have use sendmail or other solution. note port not set 25 - on purpose. godaddy's email servers configured use several ports, in case 25 blocked.

java - Regex to test if a string ends with a number -

i'd test if string ends a digit. expect following java line print true. why print false? system.out.println("i end number 4".matches("\\d$")); your regex not match entire string last part. try below code , should work fine matches entire string. system.out.println("i end number 4".matches("^.+?\\d$")); you can test quick check on online regex testers one: http://www.regexplanet.com/simple/index.html . gives should use in java code in results appropriate escapes. the .+ ensure there atleast 1 character before digit. ? ensure lazy match instead of greedy match.

windows - Ways to synchronize write access to a file on a network share -

i'm writing program using c++ under windows needs synchronize write access file via local network. thinking use following approach: //create or open using 0 sharing mode handle hfile = createfile(l"\\\\server\\share\\path\\file", generic_read | generic_write, 0, , open_always, , ,); if(hfile == invalid_handle_value && ::getlasterror() == error_sharing_violation) { //try again later } can confirm it's workable solution?

iphone - UIAccelerometer unrecognized selector sent to instance -

does get -[uiaccelerometer bytes]: unrecognized selector sent instance 0x1a23f0 i init accelerometer: uiaccelerometer *accel = [uiaccelerometer sharedaccelerometer]; accel.updateinterval = 1.0f/30.0f; accel.delegate = self; the reason asking on devices app works, , on others crashes. , not sure reason. thanks! this sounds if send accelerometer bytes message, doesn't implement. code show doesn't have problem, maybe search bytes , double-check usage.

events - close java frame using code -

possible duplicate: how programmatically close jframe i developing java gui using jframe. want close gui frame , dispose off through code. have implemented : topframe.addwindowlistener(new windowlistener() { public void windowclosing(windowevent e) { emsclient.close(); } public void windowopened(windowevent e) { } public void windowclosed(windowevent e) { } public void windowiconified(windowevent e) { } public void windowdeiconified(windowevent e) { } public void windowactivated(windowevent e) { } public void windowdeactivated(windowevent e) { } });` how can invoke windowclosing event?? or there other way? you need this: yourframe.setdefaultcloseoperation(jframe.exit_on_close); you can add line in constructor(dont forget it).

ruby on rails - Optimal order of csrf_meta_tag? -

in rails, understanding try put stylesheets before javascript, , javascript near end of document allow dom fire faster. here's question - tags go optimum performance? question specific rails' csrf_meta_tag . @ moment, have random assortment of orders - tag above css/js, in middle, below both. insight on appreciated. just try keep code clean dry. put csss, javascript , meta tag. next way: <%= stylesheet_link_tag ... %> <%= javascript_include_tag ... %> <%= csrf_meta_tag %>

jenkins - Hudson: Copy artifact from master to slave fails -

is possible use 'copy artifact' plugin copy artifact job ran on master downstream job runs on slave node? i'm getting error on slave says: hudson.util.ioexception2: hudson.util.ioexception2: failed extract /srv/hudson/jobs/myproject/builds/2011-04-29_10-28-54/archive/myartifact.foo obviously path not valid, points artifact folder on master. am missing or not possible? yes, possible. can use copy artifact plugin copy artifact slave. for first test recommend set job 1 'copy artifacts project' step set 'project name' job artifact set 'which build' 'last successful build' (ensure there one) keep 'artifacts copy' , 'target directory' empty copy artifacts slave workspace directory

jpa - How to use @Where in Hibernate -

searched few hours, i'm stuck in learning curve playframework jpa. i'm building sample website posts can made. these posts can have states: postdraft (post draft, not publish) postpublished (post can published) these states stored in seperate table. obviously, draft state posts should not visible yet. so have these classes: page class (getting page information table, 1 page can have multiple posts) posts class (posts can in draft , published) in page class have: @column(name="posts_ref") @where(clause="postpublished") private list<posts> userposts; but not working! so, how can specifify clause, load posts in published state without using jpql?? thanks! update: 2011-10-11 table: posts columns: - id - title - state_ref (reference id of states table) - content table: states columns: - id - statename so want like: select * posts inner join states on posts.state_ref = states.id states.statename = 'postpublis...

asp.net - How to set property of a Siverlight control from .aspx.cs page? -

here code public partial class mainpage : usercontrol { public mainpage() { initializecomponent(); } public string currentpage { get; set; } now want set currentpage value .aspx page load event? thanx if want pass in parameters silverlight application calling web page have specify , assign parameters inside <object ... /> tag you're using embed silverlight app. example such parameter be: <object data="..." type="..."> <param name="parameter1" value="value1" /> </object> inside application_startup method (app.xaml.cs) can query these parameters startupeventargs' initparams collection. if want hosting url can use property everywhere inside silverlight application: system.windows.browser.htmlpage.document.documenturi

c++ - Print .pdf filenames from a directory with Boost.regex -

this code: path path = "e:\\documents\\"; boost::regex reg("(*.pdf)"); for(recursive_directory_iterator it(path); != recursive_directory_iterator(); ++it) { if(boost::regex_search(it->string(), reg)) { cout << *it << endl; } } but , abort() error in visual studio, after running program, problem in line: boost::regex reg("(*.pdf)"); am not declaring regex object ? *.pdf isn't regex, it's glob (for file matching). need boost::regex reg("(.*\\.pdf)"); . : matches 1 character * : 0 or more of previous match \\ : make single \ escaping (ignore regex meaning of next character)

html - how to create a box that hovers above existing text? -

i creating dvd catalog website database of dvd images , informations such titles/genre/year etc. i need create text "sort by". when hover word "sort by", box appear below "sort by" , have several text hyperlinks such "title", "genre", "year" appearing. box should overlap existing images/texts on website. is there simple way implement this? here's how css only: the html: <div class="container"> <p>sort by</p> <ul> <li>title</li> <li>date</li> <li>artist</li> </ul> </div> the css: .container ul { display: none; } .container:hover ul{ display: inline; /* or block or whatever need */ } here's example: http://jsfiddle.net/9qbgn/8/ (just hover on "sort by")

Is it possible to use a ListView without ListActivity in Mono Android? -

i'm trying implement activity listview among other widgets. if understand correctly can't use listactivity (because shows 1 big listview ist ok me). i found lot different examples of doing in java this or this or great example . i've tried in same way doesn't work correctly. i'm curious functionality exists in mono android @ all? i found 1 example of using listview in mono android this , example describe using listactivity only. so, layout: <?xml version="1.0" encoding="utf-8"?> <tablelayout android:id="@+id/widget36" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical"> <listview android:id="@+id/list" android:layout_width="fill_parent" android:layout_height="wrap_content"> </listview> </tabl...

ruby on rails 3 - Does Amazon S3 help anything in this case? -

i'm thinking whether host uploaded media files (video , audio) on s3 instead of locally. need check user's permissions on each download. so there action get_file , first checks user's permissions , gets file s3 , sends using send_file user. def get_file if @user.can_download(params[:file_id]) # first, download file s3 , send user using send_file end end but in case, server (unnecessarily) downloads file first s3 , sends user. thought use case s3 bypass rails/http server stack reduced load. am thinking wrong? ps. i'm using carrierwave file uploads. not sure if that's relevant. amazon s3 provides called restful authenticated reads, timeoutable urls otherwise protected content. carrierwave provides support this. declare s3 access policy authenticated read: config.s3_access_policy = :authenticated_read and model.file.url automatically generate restful url.

html - How do I create a Select option that links to another page in Rails -

i have select list several options. wanna choose 1 straight away direct me page. don't wanna have submit button. how do in rails? you can achieve javascript. if using jquery can this. $(function(){ $("select#your_select_field_id").change(function(){ if ($(this).val() == "the desired field") { window.location.href = "http://stackoverflow.com"; } } }); i didn't tested code, contain syntax errors, can idea form snippet.

Using JRun 4 with IIS Express 7.5, is it possible? -

is there anyway configure iis express 7.5 utilize jrun 4 jsp pages? we trying through rewriting our remaining java server pages asp.net until completed, fact still have some, gonna force continue using full version of iis during development? i'm new iis express , fact, i'm new configuration method of iis 7.x together, we're still on 6. in advance or guidance.

python - remove all values from multiple lists at same index position with some logic -

i'm beginner in programming , beginner in python. below details better understanding of issue. rooms = ['blueroom', 'redroom', 'greenroom', 'blueroom'] availability = [5, 7, 3, 5] description = ['blue', 'red', 'green', 'blue'] price = [120, 90, 150, 115] what need have is, same lists, blueroom , of values in same index position of lists highest price removed, this: rooms = ['redroom', 'greenroom', 'blueroom'] availability = [7, 3, 5] description = ['red', 'green', 'blue'] price = [90, 150, 115] i appreciate if me. lists example, lists have handle have several rooms duplicated , have same each one. edit: first of all, thank quick answers. on other hand, forgot mention little, not less important @ all, detail. have code using old interpreter, jython version 2.2. so, functions may not work me. as jochen pointed out in comment, you're better off wri...

Get Process Status with WinApi in C (Active or Not) -

at operating system course in project have process status. coding c. example output: process no process id program name status handle count 1 5780 notepad.exe active 1 how can status , handle count? get process handle using openprocess process_query_information desired access (or use handle obtained, possibly createprocess ), try termination status using getexitcodeprocess . if returns still_active , process has not terminated yet, otherwise has. don't forget close handle using closehandle

php - Wordpress Sidebar Not Showing -

hi creating new theme in wordpress. having prob sidebar, should display main parent title children. <?php if ( !function_exists('register_sidebar')|| !register_sidebar() ) : ?> <ul id="sidebar"> <?php if($post->post_parent){ $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); $title_heading = get_the_title($post->post_parent); } else { $children = wp_list_pages("title_li=&child_of=".$post->id."&echo=0"); $title_heading = get_the_title($post->id); } if($children) { ?> <li><h3><?php echo $title_heading; ?> </h3> <ul> <?php echo $children; ?> </ul></li> <?php } ?> </ul> <?php endif; // end primary widget area ?> but not display...

visual studio 2008 - Debugging VS2008 project with url other than localhost -

in host file have provided option 127.0.0.1 localhost mysite.com can access localhost site custom name (i can access site directly via typing http://mysite.com/ in browser). issue comes how do same vs2008. want debug application url in browser http://mysite.com/ . tried putting "http://mysite.com/ " in use local iis web server option textbox of webproject properties build option can't run project that. compulsory have enter localhost url in textbox. can me in fixing above issue? edit file hosts on c:\windows\system32\drivers\etc. like this... # copyright (c) 1993-2009 microsoft corp. # # sample hosts file used microsoft tcp/ip windows. # # file contains mappings of ip addresses host names. each # entry should kept on individual line. ip address should # placed in first column followed corresponding host name. # ip address , host name should separated @ least 1 # space. # # additionally, comments (such these) may inserted on individual # lines ...

VBA Excel copy text file to worksheet -

i'm trying take statistics of specific column in text file , thought best way might copy contents text file excel worksheet , count there (otherwise need try , read 1 line directly excel file). here's code of have far: dim filepath string dim currentvalue string dim irow long dim icol long dim badaddress long dim coveragenolisting long dim activelisting long dim nocoveragenolisting long dim inactivelisting long dim fso object dim f object '' filepath include entire file name (picked browser button) filepath = activesheet.range("b2").text '' makes sure there isn't sheet named "temp_text_file" each testsheet in activeworkbook.worksheets if testsheet.name "temp_text_file" flag = true: exit next '' if there sheet named "temp_text_file" deleted if flag = true application.displayalerts = false activeworkbook.sheets("temp_text_file").delete application.displayalerts = true end if ...

selecting a class in a specific div using jquery -

i have div id , in div there div class "sizeselect". want select div , apply new class cant seem work. basically want select div "sizeselect" in div "img18" (imgid generated dynamically) $("#img"+imgid+" .sizeselect").toggleclass('selected').toggleclass('unselected'); what missing? thanks

ios - How can I check if a 3rd party static library for the iPhone SDK is compiled for Thumb? -

i'm working development platform (monotouch) not allow me link 3rd party libraries compiled thumb due bug in apple linker. how can determine if library compiled thumb or not? thanks! run otool -tv <library> on , 2 byte instructions. here example showing thumb code: http://pastebin.com/4kq52f9d here example showing non-thumb code: http://pastebin.com/137gjdr1

jpa query.getResultList() get stucked, with no error -

i have strange case, have write simple code query db in jpa2.0 every things seems good, when code hits query.getresultlist(); it stuck, , not respond, glassfish server gets 20% of cpu and nothing happen, not generate error or log. what wrong? i using glassfish, eclipselink, netbeans this code: public list<?> getdata(entitymanager em,class entityclass){ query query=em.createquery("select entity tblpromotions entity"); return query.getresultlist(); } thanks in advance try debugging it, stuck? (kill or ctrl c print stack trace, or use debugger) also turn logging on finest. it database lock, since read, must using sort of serialized transaction isolation, bad idea. how amy objects in table, taking long time.

javascript - need some advice on using getElementsByTagName -

could please explain me in details getelementsbytagname , how iterate through node list returned getelementsbytagname . here simple script want display selected index in alert window use of getelementsbytagname . know might not solution use getelementsbytagname in order selected option value still use getelementsbytagname may me better understand how works <script language="javascript"> <!-- function process(){ var = document.getelementbyid('myselect'); var res = a.options[a.selectedindex].text; alert(res); } //--> </script> and here html snippet: <body> <select name=""id="myselect" onchange="process()"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> </select> so question is: can tell me how make script work using getelementsbytagname ...

Magento Multiple Stores - Parent / Child -

i have installed magento , set 1 parent , 2 child stores. similar to: magento-mall.com – listing (ie furniture, electronics, apparel) magento-furniture.com – listing furniture. magento-electronics.com - listing electronics i have setup following: categories: main store furniture store furniture category 1 furniture category 2 computer store computer category 1 computer category 2 i set 3 websites (example domains), follows: main-store.com furniture-store.com computers-store.com main-store.com - points main store root category , listing items (ie both furniture , computers) furniture-store.com - points furniture store category – ie lists furniture items. computers-store.com - points computers store category – ie lists computer items. problem: when creating furniture-store.com using magento's "system/manage stores/create store" available root category option "main store". have furniture-store.com list both fu...

perl - How do I print a computed score for all input in a file? -

here perl code takes 2 files input. files contain tcp packets. trains normal packets using packets in first file , prints anomalous packets in second file. while (<>) { if (($time, $to, $port, $from, $duration, $flags, $length, $text) = /(.{19}) (.{15}):(\d+) (.{15}):\d+ \+(\d+) (\s+) (\d+) (.*)/) { $text =~ s/\^m//g; $text =~ s/\^ /\n/g; if (($port == 25 || $port == 80) && $text =~ /\n\n/) {$text = "$`\n";} $text =~ s/^\^@//; if ($time =~ /(\d\d)\/(\d\d)\/\d\d\d\d (\d\d):(\d\d):(\d\d)/) { $now = ((($1 * 31 + $2) * 24 + $3) * 60 + $4) * 60 + $5; } foreach ($text =~ /.*\n/g) { if (($k, $v) = /(\s*)(.*)/) { $k = substr($k, 0, 30); $v = substr($v, 0, 100); $score = 0; $comment = ""; &alarm($port, $k); &alarm($to, $flags); &alarm(...

kohana routing not working properly -

i run default routing: route::set('default', '(<controller>(/<action>(/<id>)))') ->defaults(array( 'controller' => 'welcome', 'action' => 'index', )); now have set user/index , user/login, by: class controller_user extends controller { public function action_index() { #stuff } public function action_login(){ # stuff } now have controller right called class controller_restaurants. can access restaurants/index, restaurants/view . access as: user/restaurants/index, user/restaurants/view i have @ moment: class controller_restaurants extends controller{ i tried this: class controller_user_restaurans extends controller{ but not work.. have missed? route::set('restaurants', 'user/restaurants(/<action>)') ->defaults(array( 'controller' => 'restaurants', ...

notifications - How to locally notify in iPhone? -

i want notify user after specific time. there resources on topic? guides or sample code particularly helpful. have read number of sites it, server side notifications facebook notify if message arrives or that. want triggered locally iphone app no server involved. yep! you're looking uilocalnotification . once you've created 1 , configured it, can either present immediately or schedule appear @ point in time. in other words: //create notification uilocalnotification *notification = [[uilocalnotification alloc] init]; //configure (this sets message displayed) [notification setalertbody:@"this local notification!"]; //the notification show in 60 seconds [notification setfiredate:[nsdate datewithtimeintervalsincenow:60]]; //queue notification [[uiapplication sharedapplication] schedulelocalnotification:notification]; //release object no longer care [notification release]; that's there it, really.

image loading performance problems with python and gobject -

i have script gtk(gobject) interface use posting photo blog. i'm trying improve it's responsiveness loading images in background thread. i've had no luck trying populate gdkpixbuf objects background thread, i've tried jams solid. so alternate thought i'd read files in background thread , push them gdkpixbuf's on demand. approach has yielded surprising , rather depressing performance results make me wonder if i'm doing grossly wrong. i'm playing lightly compressed jpegs off camera, tend around 3.8mb. here's original blocking image load: pb = gdkpixbuf.pixbuf.new_from_file(image_file) this averages 550ms, not huge, rather tedious if want flick through dozen images. then split up, here's file read: data = bytearray(open(self.image_file).read()) this averages 15ms, that's nice, kinda worrying, if can read file in 15ms other 535ms being spent on? incidentally bytearray call exists because pixbufloader wouldn't accept ...

python - Formatting Complex Numbers -

for project in 1 of classes have output numbers 5 decimal places.it possible output complex number , unable figure out how output complex number 5 decimal places. floats know just: print "%0.5f"%variable_name is there similar complex numbers? for questions this, python documentation should first stop. specifically, have @ section on string formatting . lists string format codes; there isn't 1 complex numbers. what can format real , imaginary parts of number separately, using x.real , x.imag , , print out in a + bi form.

magento - Site, Store, View. product visibility -

i have searched , searched , can’t seem find on helps me out , have given , decided post. looking have: 4 different web stores 1 associated view. the aim each of these different stores maintained different people. products in 1 store not viewable in store, etc. to top off have 5th store has ability show of products stores , store from. eg if browse catalog in store shown catalogues 4 other stores combined. i thought had it, don’t seem able to. if can point me in right direction here how set up, open purchasing extension if required… any appreciated. cheers, 4 different web stores 1 associated view. the aim each of these different stores maintained different people. products in 1 store not viewable in store, etc. you create 1 website 4 stores (e.g. english, french, german, italian) each store create 1 store view, define top category (e.g. top category english, top category french, etc) in each store (not store view). see in backend system > manag...

inversion of control - MVC 3 IoC Container Causes both Client and Server Validation Problems -

we have upgraded project mvc 3 tools , discovered our inversion of control container causing problems native mvc model binding validation on both client- , server-side. when have ioc hooked client validation fails fire @ , "isvalid" test in controller fires erratically , passes along data when should not. the way we've been able correct validation framework disable ioc completely. using ninject when issue first arose we've tried structuremap , unity , encountered exact same behavior. we're thinking issue may reside in idependencyresolver itself, guess. we've tried disabling 3rd party tools (telerik) issue seems in ioc. my questions community: has else experienced validation problems when using ioc in mvc? grateful guidance on issue. many thanks.

delphi - How to pass parameters to an ADOQuery object? -

i using adoquery in delphi 7 , oracle. getting error while passing parameters adoquery. have used following line. please me identify error. adoquery.sql.text:= 'select * temp_table '+ 'where column1 in (select column table2 id=:id) , id=:id'; adoquery.parameters.parambyvalue('id').value= 'abc'; adoquery.open; when open query following error: parameter object improperly defined. inconsistent or incomplete information provided. we have same problem, ended "masking" class tparameters this: declaration: tmyparameter = class(tparameter) private function getasvalue: variant; procedure setasvalue(const value: variant); public property value: variant read getasvalue write setasvalue; end; implementation: procedure tmyparameter.setasvalue(const value: variant); var ipar: integer; begin ipar:= 0 collection.count - 1 if (name = tparameter(collection.items[ipar]).name) tparameter(collection.items[...

qt - QGridLayout, 3 panes, not expanding properly -

i'm trying layout window (all in code) qgridlayout . can add widgets layout , display in window, can't figure out how resize them properly. here's i'd like [leftmost][--------center---------][rightmost] those 3 "panes" of window (all 3 of them lists). left , right ones should of static width , hug respective sides, , center should expand fill width window grows (or shrinks). some code: // create subviews, add them grid layout, , set layout window. qtableview *list = new qtableview(0); list->setsizepolicy(qsizepolicy::expanding, qsizepolicy::expanding); qtableview *flashlist = new qtableview(0); flashlist->setsizepolicy(qsizepolicy::expanding, qsizepolicy::expanding); qpushbutton *infobutton = new qpushbutton("info!"); qpushbutton *flashfeedsbutton = new qpushbutton("flashfeeds"); qgridlayout *gridlayout = new qgridlayout; // set minimum widths 3 columns of grid gridlayout->setcolumnminimumwidth(gridcolumnfirst, 300...

java - Eclipse Autogenerate Project Structure -

does eclipse support concept of reusable "project structures" via scripting/configging? for instance if want of projects - upon creation - take on form: myprojectroot/ src/ fizz/ buzz/ docs/ is there way define project structure somewhere (xml, etc.), , link new project structure? i know can write ant/maven script me, having resource save me lot of manual copying & pasting same buildscript. thanks in advance! out of box, don't think exists. one option create template project , save dir tree off somewhere. when need new project should follow template, can copy dir tree , use file -> import. another option i'd recommend use maven , have maven dictate dir structure. eclipse can import maven project.

Read a Delphi TClientDataset Files with .NET -

i need read files written tclientdataset class delphi .net code. solution mentioned here not work me. "a dotnet program not run on windows platform" means me you're deploying mono application. possibly on linux, if that's case try wine , see if delph app suggested above works expected. if yes, problem of leaving dotnet app machine solved both run on same hardware without communication through network. edit: since op specified he's using monodroid , monotouch, , therefore can't use wine- remaining options are: reverse engineer format (consult lawyer first protect harm) ask embarcadero definition of file ( don't put hope on it) modify delphi/c++ application export files in xml create delphi application preprocess *.cds , export them xml before sending them ios / android machine. of 4 alternatives, fourth 1 possibly fastest - best 1 third. the first 1 can in trouble because of laws against rev engineer around world ( in usa there...

php - Whats wrong with this URLRequest or Loader? -

i have following code: var myrequest:urlrequest = new urlrequest("http://localhost/example.com/scripts/get_peerid.php?peerid=" + myid.text); var myloader:urlloader = new urlloader(); myloader.dataformat = "urlloaderdataformat.variables"; myloader.load(myrequest); writetext(myloader.data); var vars:urlvariables = new urlvariables(myloader.data); writetext(vars.peerid); and get_peerid.php? gets displays: peerid=5a00d01af308bb4261198d92a89b939979e7ea260a3ead7d49a9b6bdd0492b72 however, writetext(vars.peerid) displays null . can't seem figure out why. ideas? the urlloader class asynchronous. quote docs: a urlloader object downloads of data url before making available code in applications. sends out notifications progress of download, can monitor through bytesloaded , bytestotal properties, through dispatched events. so, way vars.peerid work directly after calling urlloader.load method if network has 0 latency , server si...

Error is showing on else if and && statement -

if(u<=100) charge=u*1.35; else if(u=>100&&u<=200) what's wrong last statement? showing error. would if mentioned language should using >= instead of =>

c# - Private class with Public method? -

here piece of code: private class myclass { public static void main() { } } 'or' private class myclass { public void method() { } } i know, first 1 not work. , second 1 will. but why first not working? there specific reason it? actually looking solution in perspective, thats why made bold. sorry it meaningful in scenario; have public class someclass , inside want encapsulate functionality relevant someclass . declaring private class ( someprivateclass in example) within someclass , shown below. public class someclass { private class someprivateclass { public void dosomething() { } } // someclass has access someprivateclass, // , can access public methods, properties etc } this holds true regardless of whether someprivateclass static , or contains public static methods. i call nested class , , explored in stackoverflow thread .

c# - Use convolution to find a reference audio sample in a continuous stream of sound -

in my previous question on finding reference audio sample in bigger audio sample, proposed, should use convolution. using dsputil , able this. played little , tried different combinations of audio samples, see result was. visualize data, dumped raw audio numbers excel , created chart using numbers. peak is visible, don't know how helps me. have these problems: i don't know, how infer starting position of match in original audio sample location of peak. i don't know, how should apply continuous stream of audio, can react, reference audio sample occurs. i don't understand, why picture 2 , picture 4 (see below) differ much, although, both represent audio sample convolved itself... any highly appreciated. the following pictures result of analysis using excel: a longer audio sample reference audio (a beep) near end: http://img801.imageshack.us/img801/976/values1.png the beep convolved itself: http://img96.imageshack.us/img96/6720/values2i.png a longer a...

c# - How may I resolve this error? - Delegate 'System.Action<object>' does not take 0 arguments -

the following code: var ui = taskscheduler.fromcurrentsynchronizationcontext(); task.factory.startnew(() => { listbox1.items.add("starting crawl " + srmainsiteurl + "..."); } , ui); is resulting in following error: delegate 'system.action<object>' not take 0 arguments after looking @ other threads, have not been able determine nor understand cause of error. please advise. because did use public task startnew(action<object> action, object state) i think wanted use public task startnew(action action, cancellationtoken cancellationtoken, taskcreationoptions creationoptions, taskscheduler scheduler) so example become: task.factory.startnew(() => { listbox1.items.add("starting crawl " + srmainsiteurl + "..."); }, cancellationtoken.none, taskcreationoptions.none, ui);

c++ - BFS algorithm implementation -

here code implements bfs method #include<iostream> #include<stack> #define max 100 using namespace std; queue<int> mystack; int g[max][max]; int visit[max]; int v, e; void bfs(int s) { int i, j, node; memset(visit, 0, sizeof(visit)); mystack.push(s); while(!mystack.empty()) { node = mystack.top(); mystack.pop(); if(visit[node]) continue; visit[node] = 1; cout << node << " "; for(i=0; i<v; i++) if(g[node][i]) mystack.push(i); } } int main() { memset(visit, 0, sizeof(visit)); bfs(0); return 0; } i have question how can create real graph,i mean enter graph , using bfs method baisc bfs operation?i need in completing algorithm real graph

sql - How to effectively refresh many to many relationship -

lets have entity a, have many many relationship entities of type a. on entity a, have collection of a. , lets have "update" relationships according external service - time time receive notification relations entity has changed, , array of ids of current related entities - relations can new, existing, of existing no longer there... how can update database ef ? ideas: eager load entity related entities, foreach on collection of ids external service, , remove/add needed. not effective - need load possibly hundreds of related entities clear current relations , insert new. how ? maybe perform delete stored procedure, , insert "fake" objects a.related.add(new { id = idfromarray }) but can done in transaction ? (call stored procedure , inserts done savechanges ) or there 3rd way ? thanx. well, "from time time" not sound situation think performance improvement (unless mean "from millisecond millisecond") :) anyway, first appro...

Start background job Asp.net 4.0 application -

i facing 1 problem. have create asp.net 4.0 web application should check table database after specified interval , iterates on records. have save of records having "xxxx" in column value. created class , class has timer having 1 minute of interval. on tick method iterates on records , filter out data save. i created instance of class in application_start() method in global.asax method not fire. remember web application has no webform, not default.aspx i cannot in windows service hosting provider not support windows service. nothing in standard asp.net site run unless app started visitor. if want scheduling functionality, either need create windows service or write small app can set using windows task scheduler (or cron if you're on linux)

scheme - Sorting three numbers in ascending order -

i got home yesterday , decided try , write scheme program sort 3 numbers in ascending order. came with: (define 3) (define b 2) (define c 1) (define temp 0) (cond ( (> c) (set! temp c) (set! c a) (set! temp)) ( (> b c) (set! temp c) (set! c b) (set! b temp)) ( (> b) (set! temp b) (set! b a) (set! temp)) ( (> b c) (set! temp c) (set! b c) (set! b temp)) ) (display a) (display b) (display c) is functional way of solving problem? suggest? scheme has builtin sort function faster in cases sort alorithms use. (sort < '(5 2 6)) returns '(2 5 6) the main problem see procedure you're running swap once. that's great if can guarantee 1 in middle of other two, i'm not sure case. set! kinda ugly , when learned scheme professor told me not use because resource intensive , there better ways it. recommend putting them in list , sorting them , pulling them out of list if want way.

list - Consolidating this J code -

i'm learning j , starting basic; adding multiples of 3 , 5 below 100. got code: (+/((((i.100)|~ 3) = 0) # (i.100)),((((i.100)|~ 5) = 0) # (i.100)))-(((i.100|~15)=0) # (i.100)) but seems there should easier way. there way make code cleaner? thanks. note current code gives length error have suggested edit question make work. i'll include working code below. (+/((((i.100)|~ 3) = 0) # (i.100)),((((i.100)|~ 5) = 0) # (i.100))) - (+/(((i.100)|~15)=0) # (i.100)) the same algorithm can written more (less parentheses anyway) altering order of operations (j evaluates "sentences" right left). (+/ ((0 = 3|i.100) # i.100) , ((0 = 5|i.100) # i.100)) - +/(0 = 15|i.100)#i.100 2318 rather subtracting sum of multiples of 15 original sum avoid double counting number multiples of both 3 , 5, use ~. (nub) remove duplicates list of multiples of 3 , multiples of 5 before summing them. +/ ~. ((0 = 3|i.100) # i.100) , (0 = 5|i.100) # i.100 2318 for more jis...

sqlite - is there an emacs interface to a relational database? -

i need enter many text fields in database , looking enter them through form might create in ms access or open/libreoffice's database. there such template-generating package emacs talk 1 of such databases (or possibly sqlite)? there emacs widget. example: http://www.xemacs.org/documentation/beta/html/widget_3.html . here user interface. http://www.xemacs.org/documentation/beta/html/widget_2.html#sec2 . works gnu-emacs. might want write code can insert data in database, via sql. @ http://www.emacswiki.org/emacs/sql-transform.el . have insert data via org-mode tables.

xml - State of Python SOAP support at the end of 2011? -

possible duplicate: what's best soap client library python, , documentation it? we've got lots of questions asking soap support in python, none recent. what soap libraries right python? in case, i'm using python 2.7 django, , want communicate else's soap service (which far know doesn't publish wsdl - provide xsd). promising projects include: suds - https://fedorahosted.org/suds/wiki/documentation - recommended elsewhere on stackoverflow also. generateds - http://pypi.python.org/pypi/generateds/ pyxb - http://pyxb.sourceforge.net/index.html

iphone - TableView with multiple switches -

i have tableview multiple of switches(one switch each row). best way save state switches? , in methods should save , retrieve data? save data in array, haven't given context may using array of sort drive number of rows in table , rest of content? you set value of switch in cellforrowatindexpath: method. i've assumed following: you have pointer switch within cellforrowatindexpath method you have created mutable array , filled nsnumber objects so, when you've got cell , return it: cellswitch.on = [[switchvaluearray objectatindex:indexpath.row] boolvalue]; your setter method little more complicated because of switches calling same action method. therefore need find out row switch in. in method you've connected value changed of switch -(ibaction)switchvaluechanged:(uiswitch*)sender { nsindexpath *indexpath = [self.tableview indexpathforcell:(uitableviewcell*)[sender superview]]; [switchvaluearray replaceobjectatindex:indexpath.row with...