Posts

Showing posts from June, 2013

c++ - How to distinguish between movie and image -

is there "good" way distinguish between movie file , image file? know "std::wstring filepath" - movie, or image. therefore, go further strong assurance working known file type. in other words, have 2 classes myimage , mymovie both need path file in constructors. verify path file somehow before creating 1 of classes. bool ismovie(const std::wstring & filepath); bool isimage(const std::wstring & filepath); of course thought file extensions, i'm not sure , not prone errors solution. use file extension or other feasible solution possible.? thanks in advance you can use libmagic detect kind of file is. pass file path in , it'll give textual description or mime type file.

c# - WCF Service: MaxReceivedMessageSize (async) -

i ran exception because message size and/or array-length of data i'm transmitting wcf server client exceeds maximum size. topic occurs quite often, solutions changing maxreceivedmessagesize of service binding. var binding = new wshttpbinding { maxreceivedmessagesize = int.maxvalue }; binding.readerquotas.maxarraylength = int.maxvalue; host.addserviceendpoint(typeof(ieditor), binding, uri); but i’m interested how can resolved in different way. consider following method. might result in large byte array. tried converting image base64string. [servicecontract] public interface ieditor { [operationcontract] byte[] getimage(); } is there common pattern use beginread/endread streaming byte array in smaller chunks client? how in code? according microsoft (see this link ) contract has adjusted , end-point configuration well. <system.servicemodel> … <bindings> <basichttpbinding> <binding name="exampl

swing - ComboBox, Automatic filling. Java -

i have shopping cart records how many orders have been made using : int ordernumber , just ++ when ever new order made, want add edit function click on edit button , open new frame select order want edit via combobox, problem need combobox fill 1,2,3 etc... depending on how many orders made. had go @ achieving method below errors. ordernumberslist = new string[ordernumber]; (int = 1; <= ordernumber; i++) { ordernumberslist[i] = "" + i; } jcombobox ordernumberbox = new jcombobox(ordernumberslist); arrays 0 based. replace for (int = 1; <= ordernumber; i++) { ordernumberslist[i] = "" + i; } with for (int = 0; < ordernumber; i++) { ordernumberslist[i] = integer.tostring(i + 1); } notice assigned value i adjusted

iphone - Insert Special character in sqlite -

i try code. query = [nsstring stringwithformat:@"insert bookmark(names,details) values('%@','%@')", delegate.str, delegate.str1]; nslog(@"%@",query); sqlite3_stmt *compiledstatement; if (sqlite3_open([databasepath utf8string],&database) == sqlite_ok) { if(sqlite3_prepare_v2(database,[query utf8string], -1, &compiledstatement, null) == sqlite_ok) { if(sqlite_done != sqlite3_step(compiledstatement)) nslog( @"error while inserting data: '%s'", sqlite3_errmsg(database)); else nslog(@"new data inserted"); sqlite3_reset(compiledstatement); }else { nslog( @"error while inserting '%s'", sqlite3_errmsg(database)); } sqlite3_finalize(compiledstatement); } this want store sqlite insert bookmark(details) values('let's take example, 23

XML AND RSS Feed issues -

Image
ie states cant display feed while gc displays - refer image attached what lacking in displaying feed?(i using localhost) i told cant use localhost, ideas on how make rss feed function? you appear have prefixed rss feed html document. don't that. do validate markup.

c# - Can we apply lock to window phone from app -

i developing app in window phone 8, , need functionality of lockscreen in it. so question: is there way set lock screen through app without pressing power button of phone? unfortunately, there no way lock screen via code in windows phone 7.x or 8.

Nullpointerexception in displaying image from json url Android -

so here's code i'm working on: public class mainactivity extends listactivity { // url make request private static string url = "http://alyssayango.x10.mx/"; private static final string tag_type = "movie_type"; private static final string tag_name = "movie_name"; private static final string tag_length = "movie_length"; private static final string tag_schedules = "movie_schedules"; private static final string tag_cinema = "movie_cinema_number"; private static final string tag_url = "movie_image_url"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); mytask task = new mytask(mainactivity.this); task.execute(url); } public string readmovieschedules(string url) { stringbuilder builder = new stringbuilder(); httpclient client = new defaulthttpclient(); httpget httpget = new httpget(url

android - ViewPager not shown after setting layout_weight="1" -

i have layout below <linearlayout android:id="@+id/home_screen" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <android.support.v4.view.viewpager android:id="@+id/slide_pager" android:layout_width="wrap_content" android:layout_weight="1" android:layout_height="0dp" > </android.support.v4.view.viewpager> <relativelayout android:id="@+id/footer" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" android:visibility="visible" > < .. views /> </relativelayout> </linearlayout> when setting height of relativelayout footer

why Spring Security Exception Translation Filter creates 403 Response Code for default configuration -

i pretty new spring security land. using programmatic configuration of spring security servletapi() pretty neat. here configuration: @override protected void configure(httpsecurity http) throws exception { http .securitycontext().and() .servletapi().and() .authorizeurls() .antmatchers("/login").permitall() .antmatchers("/").permitall() .antmatchers("/**").authenticated(); } i using http servlet api login not using filter this. in case unauthorised request, exceptiontranslationfilter uses http403entryforbiddenentrypoint return 403 forbidden status. in scenario: if user not authenticated, 401 status code should return. if user authenticated not authorised, 403 status code should return. but default configuration creates 403 status both case. here questions: why default entry point http403entryforbiddenentrypoint ? can 401? if change http 403 entryforbiddenentryp

python - pep381run broken when restart: httplib.ResponseNotReady -

i'm trying setup local pypi server. use pep381client synchronize official pypi server. it works fine. today encountered problem: stop (by ctr+c) , restart , pep381run raise error following: e:\tmp>pep381run.py pypi synchronizing obitools copying /packages/source/o/obitools/obitools-0.2.000.tar.gz copying /packages/source/o/obitools/obitools-0.2.002.tar.gz copying /packages/source/o/obitools/obitools-00.02.503.tar.gz copying /packages/source/o/obitools/obitools-00.02.500.tar.gz traceback (most recent call last): file "d:\python27\scripts\pep381run.py", line 31, in <module> state.synchronize() file "d:\python27\lib\site-packages\pep381client\__init__.py", line 119, in synchronize self._synchronize() file "d:\python27\lib\site-packages\pep381client\__init__.py", line 159, in _synchronize self.maybe_copy_file(project, file) file "d:\python27\lib\site-packages\pep381client\__init__.py", line 237, in maybe_cop

javascript - Comparing two arrays in jquery -

using code... var = ['volvo','random data']; var b = ['random data']; var unique = $.grep(a, function(element) { return $.inarray(element, b) == -1; }); var result = unique ; alert(result); ...i able find element of array "a" not in array "b". now need find: if element of array "a" in array "b" what index in array "b" for example "random data" in both arrays, need return position in array b 0 index. regarding comment, here solution: with jquery: $.each( a, function( key, value ) { var index = $.inarray( value, b ); if( index != -1 ) { console.log( index ); } }); without jquery: a.foreach( function( value ) { if( b.indexof( value ) != -1 ) { console.log( b.indexof( value ) ); } });

python - Stanford Parser and NLTK -

is possible use stanford parser in nltk? (i not talking stanford pos.) edited as of nltk version 3.1 instructions of answer no longer work. please follow instructions on https://github.com/nltk/nltk/wiki/installing-third-party-software this answer kept legacy purposes on stackoverflow. answer work nltk v3.0 though. original answer sure, try following in python: import os nltk.parse import stanford os.environ['stanford_parser'] = '/path/to/standford/jars' os.environ['stanford_models'] = '/path/to/standford/jars' parser = stanford.stanfordparser(model_path="/location/of/the/englishpcfg.ser.gz") sentences = parser.raw_parse_sents(("hello, name melroy.", "what name?")) print sentences # gui line in sentences: sentence in line: sentence.draw() output: [tree('root', [tree('s', [tree('intj', [tree('uh', ['hello'])]), tree(',', [',&#

c# - Send Voice To PC Modem -

i try send voice computer's modem method "write" serial port when play wave file hear noise i use code: modemport.write("atz" + "\r"); modemport.write("at+fclass=8" + "\r"); modemport.write("at+vtx" + "\r"); modemport.write("atdt" + "123456" + "\r"); modemport.write(filebyte, 44, filebyte.length - 44); // hang modemport.write("ath" + "\r");

bash - List all directories not containing a subdirectoriy -

i have solution question find . -type d -exec sh -c 'test $(find "$0" -maxdepth 1 -type d | wc -l) -eq 1' {} \; -print i wonder, whether there better (faster) method this. don't start in 'find' find process. with little more coding following commandshould work: find . -type d|awk 'nr>1{a[c++]=$0; t=t $0 subsep} end{for (i in a) {if (index(t, a[i] "/") > 0) delete a[i]} (i in a) print a[i]}' making more readable: find . -type d | awk 'nr > 1 { a[c++]=$0; t=t $0 subsep } end { (i in a) { if (index(t, a[i] "/") > 0) delete a[i]} (i in a) print a[i] }' while might more coding in solution in big directory awk based command should run faster embedded find | wc solution, in question. performance testing: i ran on directory containing 15k+ nested sub directories , found awk command considerably faster (250-300% faster) op's find | wc command.

PHP parsing external site -

i not have experience in parsing external url's grab data from, today i've try experiments: $str1 = file_get_contents('http://www.indiegogo.com/projects/ubuntu-edge'); $test1 = strstr($str1, "amount medium clearfix"); $parts = explode(">",$test1); $parts2 = vsprintf("%s", $parts[1]); $str2 = file_get_contents('http://www.indiegogo.com/projects/ubuntu-edge'); $test2 = strstr($str2, "money-raised goal"); $test3 = str_ireplace("money-raised goal", "", "$test2"); $test4 = str_ireplace("\"", "", "$test3"); $test5 = str_ireplace(">", "", "$test4"); $test6 = substr($test5, 0, 29); $test7 = explode("raised of", $test6); $test8 = vsprintf("%s", $test7[1]); try code with: print_r($parts2); print_r($test8); , echo "$parts2 - $test8"; because it's popular days ubuntu edge campaign have

java - calling function should return default value, if object (or any function result) is null -

is possible wrap following code in reusable function? edit: this example, want working solution recursion depths what want following code generated: if (myobject o == null || o.getsubobject() == null || o..getsubobject().getsubsubobject() == null /*|| ... */) return defaultvalue; return o.getsubobject().getsubobject()/*...*/.getdesiredvalue(); by calling like object defaultvalue = null; object result = nullsafecall(o.getsubobject().getsubobject()/*...*/.getdesiredvalue(), defaultvalue); the seond code block idea, don't care how looks like, want i, if desired, can avoid null checks before calling deeper function... injection propably, there no other/easier solution? never looked @ injection before yet... edit2: example in language: http://groovy.codehaus.org/operators#operators-safenavigationoperator not really, code write way horrible and/or use slow reflection. unless use actual java preprocessor can understand , change code you

c++ - How I can auto increment each class objects? -

i have class contain 2 private int , 1 const (m_id) , other 1 static (next_id). i want set m_id next_id , increment next_id each time create object of class. but since it's const can't set : class::class() { m_id = next_id++; } i need set class::class() :m_id(next_id) { next_id++; } but that's not either because can't access private static that. someone told me const not intented used that, remove it. solution? edit : here full header , source header #ifndef entity_h_lea12oed #define entity_h_lea12oed #include "entitykey.h" #include "componentmanager.h" class entity { public: entity (); virtual ~entity (); private: ekey m_key; componentmanager m_componentmanager; const int m_id; static int next_id; }; #endif /* end of include guard: entity_h_lea12oed */ source #include "entity.h" entity::entity() :m_id(next_id++) { } entity::~entity() { } (of course entitykey , componentmanage

android - Communicating between mobile devices over a local network -

i'm complete newbie regards developing android, , starters i'm trying develop simple card game can played multiplayer on local network. i'm having trouble finding starting point how go this, can find plenty of things communicating across internet not having luck seeing how communicate directly between 2 devices on lan. it's major part of plan app multi-platform , ios devices , android devices can play against each other, i'm looking method supports this. know it's possible can see there other apps have functionality. i don't need detailed implementation (although more better!) if point me in right direction how go this, i'd grateful. i think u need connection peer peer, android implements wifi direct look android dev site. http://developer.android.com/guide/topics/connectivity/wifip2p.html

python - NoSuchTable Error Message -

i getting "nosuchtable" error message. know table (dba_users) exists because can query in separate script , results returned. i'm parameters "pull_data" recognized because "print 'processing=' table_name" returns correct value. script listed below. processing dba_users pulling schema source server 2013-07-25 08:15:15,661 info sqlalchemy.engine.base.engine select user dual 2013-07-25 08:15:15,661 info sqlalchemy.engine.base.engine {} 2013-07-25 08:15:15,802 info sqlalchemy.engine.base.engine select column_name, data_type, char_length, data_precision, data_scale, nullable, data_default all_tab_columns table_name = :table_name , owner = :owner order column_id 2013-07-25 08:15:15,802 info sqlalchemy.engine.base.engine {'owner': u'itaudit', 'table_name': u'dba_users'} import data import getopt import sys quick_mapper import quick_mapper make_session import make_session sqlalchemy import metadata, table s

string - C# "or" operator -

i have code: if (textbox1.text == "one" || "two") i have tried use || , | add more strings, says cannot applied operands of type "bool" , "string". how can make work? thank you. or alternatively : var strings = new list<string>() {"one", "two", "thee", .... "n"}; if(strings.contains(textbox1.text)){ }

sql - Script to merge four access tables -

i attempting write script access add records not exist 1 table next, keep track of records not merged, , preserves relationships between second table i'll updating. unable figure out how to, using vba or sql, insert data source table destination table doesn't exist in destination table. can suggest way me copy on data table a table b , when 2 of rows fields don't exist in table b ? ex. have table a 4 rows , table b 4 rows. wish copy on data table a value of fields x , y don't exist in of table b 's x , y fields. thank in advance. insert tableb (columns) select [values] tablea left outer join tableb b on (a.x = b.x , a.y = b.y) b.x null the outer join include entries there's no value table b, , filters on these rows

ios - Additional readonly properties from keys via category -

in project, getting passed data object (xyzcustomclass) custom sdk. never need modify object, use , present data in ui. custom data object has 5 normal string properties, , nsdictionary type property called "addditionalproperties". dictionary contains set of key value pairs. what want in client part, have real properties on custom data object match keys. want have nice interface being real property. don't want have stuff hidden under keys, while other accessible normally. i want create category on data object declare 1) public readonly properties each key 2) implement getters retrieve object particular key relevant particular property. working on 4.6.3 xcode. base sdk 5.0. approach ok? work? remember, readonly, please no associated object suggestions. you can dot sugar syntax, if simple declare method on .h file of category so: @interface customdataobject (additionalproperties) -(nsstring *)amount; @end you can: nslog(@"%@", myobjec

HTML email horizontally extends fixed width in Microsoft Outlook -

i've got lot of time wrapped in template, it's mobile optimized , compatible dotmailer's easybuilder software noobs edit. when email received outlook (dektop client) extends right width horizontally elements following suit. elements full width not extend (not want them extend!) i'd appreciate guys - please find screenshots attached , code snippet below (due character limits here i'll paste in header/upper content). screenshots <style>.readmsgbody{width:100%}.externalclass{width:100%}#outlook a{padding:0}body{width:100%!important;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;margin:0;padding:0}a img{border:0}a,a:visited,a:hover,a:active{color:inherit!important}img{outline:0;text-decoration:none;-ms-interpolation-mode:bicubic}.applelinks a{color:#333;text-decoration:none}.externalclass{width:100%!important}.externalclass,.externalclass p,.externalclass span,.externalclass font,.externalclass td,.externalclass div{line-height:100%}.externalc

html - How to fix the alignment of the dropdown menu in a navigation -

so i'm doing website... want dropdown navigati http://forever21.com can't seem fix mine.... it's overlapping whole navigation div. please help! here's code: ` nav li .first{ border-right:left: 1px dotted #ddd; } nav ul ul { display: none; } nav ul li:hover > ul { display: block; } nav ul { list-style: none outside none; position: relative; display: inline-table; margin-top: -18px; margin-left: 31px; } nav ul:after { content: ""; clear: both; display: block; } nav ul li { float: left; list-style: none outside none; display: inline; color: rgb(68, 68, 68); border-right: 1px dotted rgb(221, 221, 221); font-size: 20pt; font-family: "questrial",arial,sans-serif; padding: 20px 17px 10px 20px; margin-top: -17px; } nav ul li:hover { background: #4b545f; color: #fff; } nav ul li { list-style: none outside none; display: inline; letter-spacing: 2px; font-size: 11px; text-transform: uppercase; color: #444444; padding-top:20px; }

sql server - How can I select integer values from an NVARCHAR column in a SQL query? -

i'm using sql server 2005. i'm trying values of fk_unitserial integers. column defined nvarchar(255), not null . i think i'm selecting numeric values column , determining if values in specific range using following query: select t.pkid, t.fk_unitserial ( select r.pkid, r.fk_unitserial tbl_ovenresults r isnumeric(r.fk_unitserial + '.0e0') = 1 ) t convert(decimal(38, 0), t.fk_unitserial) between -2147483648 , 2147483647 order t.pkid but running gives me message: msg 8114, level 16, state 5, line 1 error converting data type nvarchar numeric. it looks offending value 129896545820 , running select convert(decimal(38, 0), 129896545820) works expected. what missing? edit i guess i'm asking, maybe, if isnumeric ever returns 1 values can't used in convert(decimal(38, 0), value) . sql server reserves right rearrange expressions, exception of case statement. means can have offending values passed subquery outer que

XSLT with XProc - parameter binding in the required type -

i'm trying translate batch file calling saxon (version 8.9) xproc pipeline (calabash). batch call: java -jar saxon8.jar -o out.xml in.xml style.xsl +config=config-file.cfg the parameter config defined in stylesheet in way: <xsl:param name="config" as="document-node()"/> the xproc part looks this: <p:load name="configload"> <p:with-option name="href" select="'config-file.cfg'"/> </p:load> <p:xslt name="config"> <p:input port="source"> <p:document href="in.xml"/> </p:input> <p:input port="parameters"> <p:inline> <c:param name="config"> <p:pipe port="result" step="configload"/> </c:param> </p:inline> </p:input> <p:input port="stylesheet"> <p:do

html - Image list with differents <li> height -

i have simple list of images each <li> element has same static height forced .container inside. selected element can 2 (or 3) times higher i trying make using display:inline-block selected element pushing next line lower http://jsfiddle.net/hedzk/1/ or float:left working bit better not enaught, elements still pushed lower http://jsfiddle.net/hedzk/2/ is there way correctly? i dont want use position:absolute neither <table> because crash responsive design there's no way solve using css only. should on js-based solution http://isotope.metafizzy.co/

.net - ASP.NET Web API Custom JsonConverter is never called -

so here's situation. i'm implementing web api in webforms app. have bunch of dynamic classes dictionaries need use custom json serialization formatter in order work (because default converter shows mess of key value pairings). so first created custom json converter: /// <summary> /// class convert entities json /// </summary> public class entityjsonconverter : jsonconverter { public override bool canconvert(type objecttype) { return objecttype.issubclassof(typeof(entity)); } public override bool canread { { return true; } } public override bool canwrite { { return true; } } public override void writejson(jsonwriter writer, object value, jsonserializer serializer) { // details not important. code called , works perfectly. } public override object readjson(jsonreader reader, type objecttype, object existingvalue, jsonserializer serializer) { // details not impor

Scrapy python : unicode links error -

link encoding when scraping site scrapy extracts links containing &amd , throws excption: not instantiate link objects unicode urls. assuming utf-8 encoding (which wrong) how can fix error? i had same problem character → inserted on links. found this related commit on github , used this advice write file link_extractors.py with: from scrapy.selector import htmlxpathselector scrapy.contrib.linkextractors.sgml import sgmllinkextractor scrapy.utils.response import get_base_url class customlinkextractor(sgmllinkextractor): """need fix encoding error.""" def extract_links(self, response): base_url = none if self.restrict_xpaths: hxs = htmlxpathselector(response) base_url = get_base_url(response) body = u''.join(f x in self.restrict_xpaths f in hxs.select(x).extract()) try: body = body.encode(response.encoding)

list - Modify an element in Map -

i have defined types follows: module smap = map.make(string) type s = { t: int fa: int list } type t = s smap.t i write function modify add 100 list fa element corresponding key . following code works: let modify (key: string) (x: t) = let = smap.find key x in smap.add key { fa = a.fa @ [100] } (smap.remove key x) however, removing , adding element looks redundant me... tell me if there better way directly modify it? yes, can add it. a map can contain key once, if add mapping key, remove previous one. http://caml.inria.fr/pub/docs/manual-ocaml/libref/map.make.html#valadd

what is this "CONSTANT>>1" in c++\msdn -

i'm working on code given me cousin. in code there symbol don't recognize. awesome if can recognize , explain me! object_size constant ">> 1" part need understanding. "object_size>>1" m_centerpt = point2f(middle.x - (object_size>>1) - midoffset, middle.y - (object_size>>1) - midoffset); the >> operator shift right; shifting positive number right 1 bit equivalent integer-dividing 2 (for same reason why removing last digit of decimal number equivalent of integer-dividing number ten).

xcode - How to add different Custom Cells in one TableView with Storyboard? -

Image
i want add 2 or more diffrent custom cells in 1 tableview, using storyboard. know how add diffrent cells without storyboard. way: static nsstring *cellidentifier = @"cell"; customcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; //picturecell = [[detailpicturecell alloc]init];//(detailpicturecell *)[tableview dequeuereusablecellwithidentifier: cellidentifier]; picturecell.header = true; [picturecell setheader]; if (cell == nil) { if ([indexpath row] == 0) { nsarray *nib = [[nsbundle mainbundle] loadnibnamed:@"headerangebotviewcell" owner:self options:nil]; nslog(@"new header cell"); } if([indexpath row] ==1){ nsarray *nib = [[nsbundle mainbundle]loadnibnamed:@"productcell" owner:self options:nil]; cell = [nib objectatindex:0]; } and question: how can storyboard? add 1 custom cell possible. can not add 2 diffrent cell. can me please? in attributes inspector table view, s

c# - how do I get additional scopes using SocialAuth.NET for FaceBook? -

heres trying achieve, want retrieve users details , additional parameter adding additional parameter(user_location). i have put in web.config(xx replacing keys): var profile = userprofilebll.retrieveprofilebyuserid(guid.parse(user.provideruserkey.tostring())); profile.facebooksynced = true; profile.validemail = true; profile.country = country; var test = new brickred.socialauth.net.core.wrappers.facebookwrapper(); string city = test.additionalscopes[0].tostring(); i not sure if right @ , cant seem find out how use , i've done lot of googling no avail. documentation limited least. not sure if time request parameter user has been authenticated etc. its incorrect hence why need bit of guidance. thanks. curious, why need retrieve scope? once add additional_scopes, socialauth.net automatically passes them onto facebook

hadoop - Where Does the HDFS Account for Triple Replication in Usage Reports? -

in latest version of hadoop distributions, hdfs usage reports seem report on space without accounting replication factor, correct? when 1 looks @ namenode web ui and/or runs 'hadoop dfsadmin -report' command, 1 can see report looks this: configured capacity: 247699161084 (230.69 gb) present capacity: 233972113408 (217.9 gb) dfs remaining: 162082414592 (150.95 gb) dfs used: 71889698816 (66.95 gb) dfs used%: 30.73% under replicated blocks: 40 blocks corrupt replicas: 6 missing blocks: 0 based on machine sizes of cluster, seems report not account triple replication... i.e. if place file on hdfs, should account triple replication myself. for example, if placed 50gb file on hdfs, hdfs dangerously close full (since seems file replicated 3 times, using 150gb remain)? let define each of these terms mean. configured capacity: total capacity available hdfs storage. if have 4 nodes , each node has 50 gb capacity, configured capacity 200 gb. replication factor ir

regex - Patterns in Lua: unify different input date formats -

i unify dates format: "d+/m+/yyyy h+:n+" i have kind of inputs: -- dd/mm/yyyy 24/09/1986 1/09/1986 01/9/1986 -- dd-mm-yyyy 24-09-1986 1-09-1986 01-9-1986 05/12/2012 0:00:00 09/24/2012 24/9/1986 00:01 24/9/1986 0:1 24/9/1986 03:01 p.m. 24/9/1986 3:01 p.m. 24/9/1986 0:1 a.m. 24/9/86 24/9/86 03:01 p.m. 24/9/86 3:1 a.m. 24/9/86 00:01 24/9/86 0:1 24-09-1986 12:12 24-09-1986 12:12 24-09-1986 12:12 24-09-1986 12:12 i know in lua can make similar this: p= '%d+/%d+/%d%d%d%d %d%d:%d%d [ap]m' if string.match('6/5/2013 12:06 pm',p) print('ok') else print('not ok') end i've planned make if-else anidation. but, can see, there lot of possibilities in input formats. please suggest me smartest solution? for example, have done function: function opunifydateformat( config, section, document ) local trazas = assert(io.open("d:\\logsapp\\autonomy\\desarrollos\\scriptslua\\commonfunctions\\trazas_lua_opunifydateformat.log",

File creation in c# -

i working on small address book app, have make folder , inside folder .xml file, , problem app creates folder can't create file! here code: private void form1_load(object sender, eventargs e) { string path = environment.getfolderpath(environment.specialfolder.applicationdata); if(!directory.exists(path + "\\address book - neca")) directory.createdirectory(path + "\\ address book - neca"); if (!file.exists(path + "\\address book - neca//settings.xml")) file.create(path + "\\address book - neca//settings.xml"); } i've improved code, take look. folder path has spaces between \ . include: using system.io; and after: private void form1_load(object sender, eventargs e) { // prepare path string path = environment.getfolderpath(environment.specialfolder.applicationdata); // prepare folder path string folderpath = path.combine(path, "address book - neca"

iphone - What is kAudioSessionProperty_InputSources actually good for? -

i've tried fetch list of available audio input devices on iphone using code: cfarrayref arrayref; uint32 size = sizeof(arrayref); osstatus status = audiosessiongetproperty(kaudiosessionproperty_inputsources, &size, &arrayref); assert(status == noerr); nsarray *array = (__bridge nsarray *)arrayref; the call works , returns without error, results array empty, no matter hardware have connected it. i've tried 2 usual headsets mobiles, original 1 apple , 1 samsung , 2 kinds of usb microphones (an ixy rode , im2x tascam ), array stays empty. wonder kinds of input sources listed property? usable @ all? by using listener callback on audio routes, able verify 4 devices detected correctly. able record audio each of devices, work properly. use iphone 4s ios 6.1.3 (10b329). i'm new audio programming on iphones don't have answer question of particular property for, if want list of audio inputs, think work: nsarray * ais = [[avaudiosession sharedinstance

git - What is the best way to perform a complex refactoring spanning multiple repositories? -

i need re-organize project using git. project has 3 separate (central) repositories , need move large number of files , forth between them. while doing this, there development going on on each repository, , restructuring take time. have been continuously rebasing refactor branches master in each respective repository. is there established way of doing sort of complex cross repository refactoring in way preserves history across repositories , takes advantage of git's rename merge logic across repositories, moving repos third one, merge , move back? effectively, have 3 repositories, a, b, , c. want move files b , c , preserve history. not simple move of 1 directory, large number of individual files being moved new locations, renamed, updated etc. have been working across a, b, , c, moving , updating files, not keep history of files being moved across repositories. imagine possible create new repository d, import a, b, , c sub directories, rebase merge individual commits on a,

winforms - Use other GUI components while textbox is updating in realtime? -

so i'm using c# ms visual studio 2010. i'm recieving realtime data via udp , logging data textbox on gui. think using backgroundworker update textbox on different thread best way this. but, how can use scroll bars on textbox while textbox updating realtime. scroll bar disabled while data being logged. thanks help, cheers.

how to write mongodb query for 'counting elements in sub-document' -

i have collection this... { { id: 123, name: "abc", data: { type1: 0.78, type2: 0.89, type3: 0.67 } purpose: "commercial" }, { id: 124, name: "pqrs", data: { type1: 0.34, type2: 0.78, } purpose: "open" }, { id: 125, name: "xtec", data: { type1: 0.48, type2: 0.56, type3: 0.67 type4: 0.56, type5: 0.67 } purpose: "some other" } } i count number of elements in "data" sub-document. 1 post me mongodb query? or display documents "data" sub-document length = 3 the below query doesn't work db.test.find({$where : 'data.length = 3'}); any appreciated. thank you!! regards, raj try this, put condition inside count method, can use

c# - 'Method not found' error with Windows Service -

i have windows service written in c# using vs2012 , 4.5 framework. service consists of 2 other projects objects databases, use .edmx files , ef5. edmx projects: mycompany.data.masterdb mycompany.data.statstracker the service makes 2 calls methods within itself; 1 generates list of files process , if there more 0, returns true, otherwise false.... , other method process these files. //only proceed if there files process. if (generatefilelist()) processlogs(); the 2nd method (called processlogs ) try use context other projects , getting following error: method not found: 'system.data.entity.dbset1<mycompany.data.masterdb.statisticlogtype>mycompany.data.masterdb.masterdbcontext.get_statisticlogtypes()'. here's few lines of processlogs method (this wrapped in try/catch): statisticlogtype duplicateslogtype; statisticlogtype successlogtype; masterdbcontext sccontext = new masterdbcontext(); statstrackercontext utcontext = new statstrackercontext(

postgresql 9.1 - pgpool-II connection pooling - ERROR: "MD5" authentication with pgpool failed -

using following connection pooling no master_slave or replication: rhel 6, postgresql 9.1.9, & pgpool-ii 3.1.3 (also tried 3.2.5) followed solution suggested in http://www.pgpool.net/pipermail/pgpool-general/2013-may/001773.html after following instructions md5 tried setting both pg_hba.conf , pool_hba.conf trust local , subnet, still following error when attempting connect pool locally: error: "md5" authentication pgpool failed user foo tried locally on fedora 18 pg9.2 , pgpool fedora repo , worked right out of box. at end of routes suggested everywhere find. help appreciated. after having hit same problem solution change ownership of pool_passwd file postgres. even though file has 644 permission, if owner isn't postgres you'll aforementioned error. guess file's owner , user running pgpool must match. i'm running posgresql 9.2 , pgpool-ii 3.3.2, btw.

C: Assigning string variable using precision specifiers like printf -

i want assign string variable using precision specifiers printf uses , without using ton of loops. code passed in date command line in form of yyyymmdd. print date in mm/dd/yyyy format, following: char *date = argv[2]; printf("%.2s/%.2s/%.4s", &date[4], &date[6], date); so passing '20130725' command line print '07/25/2013' however, not work if try: char *formatted_date = ("%.2s/%.2s/%.4s", &date[4], &date[6], date); printf("%s\n", formatted_date); passing '20130725' command line print '20130725' back. how assign variable in way similar this, or not possible in c? you can't @ initialization time, can use sprintf(3) : char formatted_date[11]; // mm/dd/yyyy plus null terminator sprintf(formatted_date, "%.2s/%.2s/%.4s", &date[4], &date[6], date); printf("%s\n", formatted_date);

web services - soap header doesnt appear in http traffic when coming from biztalk -

Image
i trying construct message in biztalk send out web service. when call web service c# see traffic(from fiddler) this: <s:envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:header> <h:authenticationinfo xmlns:h="urn:ticket" xmlns="urn:ticket" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <username>user_name</username> <password>password</password> <authentication/> <locale/> <timezone/> </h:authenticationinfo> </s:header> <s:body xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <createtroubleticket xmlns="urn:ticket"> <serviceid>asd</serviceid> <servicetype>service typ

debugging - In Durandal how can you get a handle to the active VM in debug or developer tool console? -

building app duranrdal first time , i'd able use chrome developer tools console inspect values of view models on various pages loaded. the problem there no window.durandal or window.mainapp can see. in main.js define function: window.myapp = app; but seems hack, , doesn't me handle current viewmodel. thought doing similar code in router, ugly. is app & current vm accessable in clearner way? perhaps require.js when loads modules puts reference on dom somewhere? suppose if can handle router i'd ok. i'm interested in getting handle vm backing modal dialog..not sure if can off router or other piece. in chrome developer tools can put break points in viewmodels , step through code. also, durandal logs viewmodel objects have been composed console.log can see state @ bound view. here way making use of mechanics of requirejs reference viewmodel object programmatically. type chrome console: require(['durandal/pluggins/router','yourv