Posts

Showing posts from July, 2010

vagrant - How to stop foreman logging to stdout? -

i'm using foreman in a vagrant vm run gunicorn. have foreman start last item when provision vm, leaves logging stdout. i'd prefer log log file , release terminal me. then, should want see foreman logs, can tail file. i feel must have missed something, doesn't sound difficult thing, i'm stumped. have cancel, twice, out of foreman logging, messy end provisioning! the entries in procfile commands run , can tinker them same way on command line. so redirect of stdout unicorn process /dev/null or redirect output process 2>&1 like: web: gunicorn myproject.wsgi 2>&1 in order foreman release terminal you'll need run in background with: foreman &

if statement - SAS create 10 new variables according to 10 existing one with a do loop -

i have par file, 10 variables: q1-q10 has values in range of 0-1. need create each variable (q1,q2,q3...) new variable receive values of 1-5 according following range 0< q <0.2 => 1 0.2< q < 0.4 => 2 , on.. eventually each q should new column should additional column values 1-5 i have managed create 1 variable, how can 10 of them in more efficient way? data par1; set par; if q1>0 , q1<0.2 do; qq1=1;end; if q1>0.2 , q1<0.4 do; qq1 =2;end; if q1>0.4 , q1<0.6 do; qq1=3;end; if q1>0.6 , q1<0.8 do; qq1=4;end; if q1>0.8 , q1<1 do; qq1=5;end; run; proc print data=par1; run; you can use array. data par1; set par; array q{*} q1-q10; array qq{10}; = 1 dim(q); if 0 < q[i] < 0.2 qq[i] = 1; else if 0.2 < q[i] < 0.4 qq[i] = 2; else if 0.4 < q[i] < 0.6 qq[i] = 3; else if 0.6 < q[i] < 0.8 qq[i] = 4; else if 0.8 < q[i] < 1 qq[i] = 5; end;

Neo4j backup finds inconsistencies. Now what? -

the neo4j-backup reports inconsistencies database. 2015-04-22 19:27:44.175+0000 info [org.neo4j]: inconsistencies found: consistencysummarystatistics{ number of errors: 4 number of warnings: 0 number of inconsistent property records: 1 number of inconsistent relationship_group records: 3 } i able step around time restoring backup made before problem occurred, options if not possible? using neo4j 2.2.0 here. in case of commercial enterprise subscription handled part of neo technology's support. another option using michael's storecopy tool copy on database, see https://github.com/jexp/store-utils .

google spreadsheet - How does this formula to return the last value in a column work? -

this formula returns last value in column: =index(a:a;max((a:a<>"")*(row(a:a)))) can't understand how works because part max((a:a<>"")*(row(a:a))) returns 0 . any ideas? for sake of answer. segment: =max((a:a<>"")*(row(a:a))) returns 0 if row in has blank cell in columna, otherwise 1 . as array formula ( ctrl + shift + enter before enter ) get: =arrayformula(max((a:a<>"")*(row(a:a)))) returns row number of last populated cell in columna. simplifying example of 3 rows first (row1) blank: the 'not blank' part returns array of: false,true,true , row part of 1,2,3 so multiplying (the * ) these gives array 0,2,3 (multiplying false equivalent multiplying 0 , true equivalent times 1 ). the max function selects largest value ( 3 ). the index function 'reads' above return value in columna in last (third) row.

nlp - How to NER and POS tag a pre-tokenized text with Stanford CoreNLP? -

i'm using stanford's corenlp named entity recognizer (ner) , part-of-speech (pos) tagger in application. problem code tokenizes text beforehand , need ner , pos tag each token. able find out how using command line options not programmatically. can please tell me how programmatically can ner , pos tag pretokenized text using stanford's corenlp? edit: i'm using individual ner , pos instructions. code written instructed in tutorials given in stanford's ner , pos packages. have corenlp in classpath. have corenlp in classpath using tutorials in ner , pos packages. edit: i found there instructions how 1 can set properties corenlp here http://nlp.stanford.edu/software/corenlp.shtml wish if there quick way want stanford ner , pos taggers don't have recode everything! if set property: tokenize.whitespace = true then corenlp pipeline tokenize on whitespace rather default ptb tokenization. may want set: ssplit.eolonly = true so split sentenc

Rails routing helpers -

i have project structure: module xxx, has models, controllers, etc. inside module have admin module. example, when define routes: scope module: 'xxx' namespace :admin resources :pages end end i helper 'new' action: 'new_admin_page_path'. doesn't looks pretty good. want has 'admin_new_page_path'. may wrong think name looks better. how can in more correct way? possible have 'xxx_admin_new_page_path'? upd: want actions have format, not new. example: xxx_admin_pages_path, xxx_admin_new_page_path, xxx_admin_edit_page_path , xxx_admin_page_path there no documentation on doing resources. afaik it's not possible. scope 'xxx', as: :xxx scope 'admin', as: :admin 'pages', controller: 'posts', action: 'index', as: :pages 'pages/new', controller: 'posts', action: 'index', as: :new_pages end end

windows - Date modified of most recent file(s) in a set of sub-directories -

i need assistance in creating output file (or 'report') based on bunch of sub-folders. want email report myself nightly (i can handle emailing of file, not sure how create actual file). my data structure: main working directory containing: my .bat file copies data 3 servers tfx logs folder below tfx logs folder client folder(s) up 15 days of .log files what want do: copy data 3 servers tfx log folder, maintaining structure (tfx log\client\tfx_*.log) ( completed ) create single .txt or .csv file list of newest tfx_*.log files each client folder (just newest - not 15 files there). this: directory name | file name | date modified email file myself ( completed ) i need number 2. this have far: :: copying data xcopy "%source1%" "%destination%\tfx logs\" /s /y xcopy "%source2%" "%destination%\tfx logs\" /s /y xcopy "%source3%" "%destination%\tfx logs\" /s /y :: deleting old output file be

sed - PHP - How to do a string replace in a very large number of files? -

i have 2 million text files in server online accesible internet users. asked make change (a string replace operation) these files possible. thinking doing str_replace on every text file on server. however, don't want tie server , make unreachable internet users. do think following idea? <?php ini_set('max_execution_time', 1000); $path=realpath('/dir/'); $objects = new recursiveiteratoriterator(new recursivedirectoryiterator($path), recursiveiteratoriterator::self_first); foreach($objects $name => $object){ set_time_limit(100); //do str_replace stuff on file } use find , xargs , sed shell , i.e.: cd /dir find . -type f -print0 | xargs -0 sed -i 's/old/new/g will search files recursively (hidden also) inside current dir , replace old new using sed . why -print0 ? from man find : if piping output of find program , there faintest possibility files searching might contain newline, should consider usi

javascript - LinkedIn Member Profile Plugin error -

i'm trying out linkedin's member profile plugin generator: https://developer.linkedin.com/plugins/member-profile it generated script tags inclusion on html page: <script src="//platform.linkedin.com/in.js" type="text/javascript"></script> <script type="in/memberprofile" data-id="<profile url>" data-format="inline" data-related="false"></script> when inserted code on page, generated error in console: secureanonymousframework?v=0.0.2000-rc8.44973-1428&:463 uncaught typeerror: cannot read property '2' of null getlocation @ secureanonymousframework?v=0.0.2000-rc8.44973-1428&:463 preparetransportstack @ secureanonymousframework?v=0.0.2000-rc8.44973-1428&:556 easyxdm.rpc @ secureanonymousframework?v=0.0.2000-rc8.44973-1428&:637 place @ secureanonymousframework?v=0.0.2000-rc8.44973-1428&:3092 e @ secureanonymousframework?v=0.0.2000-rc8.44973

ruby - rails elastic search relationship attributes not indexed -

basically got 3 models(book,chapter,author), , want include of books , author attributes when indexing chapter. here chapter.rb class chapter < activerecord::base belongs_to :book, :counter_cache => true include elasticsearch::model index_name [rails.env, model_name.collection.gsub(/\//, '-')].join('_') mappings indexes :id, type: :integer indexes :title, type: :string indexes :description, type: :string indexes :content, type: :string indexes :updated_at, type: :date # date example indexes :book_title indexes :book_type indexes :author_name indexes :book_id end def book_title book.title end def book_type book.book_type end def author_name " #{book.author.firstname} #{book.author.lastname} " end def to_indexed_json to_json methods: [:book_title, :book_type, :author_name] end end http://localhost:9200/development_chapters/_mapping?pretty show

Does chrome understand compiled javascript? -

instead of having v8 compile javascript on fly , then execute it, isn't possible compile javascript beforehand , embed machine code in page instead of embedding javascript in page? the way understand it, v8 javascript engine compiles machine code anyway why not beforehand? according w3c html5 scripting specification , there's no standards-based reason why browser couldn't support machine code special type attributes (as chrome dart language): the following lists mime type strings user agents must recognize, , languages refer: "application/ecmascript" "application/javascript" ... user agents may support other mime types other languages... currently, no browser has implemented such feature. i suspect primary shortcoming of such approach each chip architecture require machine-code version of script compiled specifically. means in order support 3 architectures, page need include compiled script 3 times. (and should inc

javascript - Calculate height of div -

i have div set height. <div class="foo" style="height:100px;">bar</div> is possible find div's height if height not explicitly set style property? in other words, i'd find height of following div without changing div. <div class="foo">bar</div> var clone = $('.foo').clone(); clone.css('height', 'auto'); clone.css('visibility', 'hidden'); $('body').append(clone); console.log(clone.height());

python - PyQt: display QPushButton that looks like the down-arrow button in QComboBox -

in pyqt4, want present qpushbutton looks down-arrow button in qcombobox. feasible, , if so, how? i don't need getting new widget-combination acting qcombobox (see below). want qpushbutton display/graphic look down-arrow button in qcombobox - , tips/code on how overlay graphic (especially if said graphic comes via file) onto own qpushbutton. more details, context: i'm seeking replace qcombobox widget qlineedit + qcalendarwidget, because qdateedit isn't customizable need (i think...). thought place qpushbutton adjacent (on right-side) of qlineedit make things regular qcombobox as possible. said button .exec_() qcalendarwidget (which technically wrapped qdialog). let me know if doesn't make sense, , can provide further or clarified context. you can try qtoolbutton no text , arrowtype property set qt.downarrow . eg: myqtoolbutton.setarrowtype(qt.downarrow) .

entity framework - Rollback to a specific migration -

what steps rolling specific migration state. i want remove field url....so ran command below. update-database –targetmigration: addurl the column name on db table removed added when ran application. do manually remove '201504212002469_addurl' file under migrations folder , else added? you don't need delete records __migrationhistory. just roll previous migration. if have 2 migrations: 201504212002468_something 201504212002469_addurl run update-database --targetmigration:something after can remove 201504212002469_addurl.cs , other related files project.

angularjs - 404 Error with simple Express routing -

i trying set routing in node.js app using express.js , mongoose.js using tutorial - https://thinkster.io/mean-stack-tutorial/ when test curl, gives me message: (the curl script is: curl --data 'title=test&link=http://test.com' http://localhost:3000/#/posts ) error: not found @ /users/adamz/flapper-news3/app.js:30:13 @ layer.handle [as handle_request] (/users/adamz/flapper-news3/node_modules/express/lib/router/layer.js:82:5) @ trim_prefix (/users/adamz/flapper-news3/node_modules/express/lib/router/index.js:302:13) @ /users/adamz/flapper-news3/node_modules/express/lib/router/index.js:270:7 @ function.proto.process_params (/users/adamz/flapper-news3/node_modules/express/lib/router/index.js:321:12) @ next (/users/adamz/flapper-news3/node_modules/express/lib/router/index.js:261:10) @ /users/adamz/flapper-news3/node_modules/express/lib/router/index.js:603:15 @ next (/users/adamz/flapper-news3/node_modules/express/lib/router/index.js:246:14

html - How to detect changes on iframe -

i have iframe. it's height dynamic. on load it's height reset don't see scroll bar on right. problem when size of elements change in iframe, not know how detect changes, tried giving onchange attribute html set height again, onchange didn't fire. appreciated.

java ee - nullpointerexception when persisting bean -

i use wildfly 8.2, javaee 7 , h2 database. when try persist or merge entity, got npe. below classes. know why? @entity public class patient implements serializable { @id @generatedvalue(strategy = generationtype.auto) private long id; private string firstname; private string lastname; private date dob; //getters/setters here } my ejb service. findall() works fine. @stateless public class patientservice { @persistencecontext(unitname="patient-pu") private entitymanager em; public list<patient> findall() { criteriaquery<patient> cq = em.getcriteriabuilder().createquery(patient.class); cq.select(cq.from(patient.class)); return em.createquery(cq).getresultlist(); } public void saveorpersist(patient entity) { if (entity.getid() > 0) { em.merge(entity); } else { em.persist(entity); } } } persistence.xml <?xml version="

Android layout weight imageview not visible -

i have confusing problem android layout. when use 1 imageview image not visible, if use 2 imageview (one dummy view) can see images. problem exist in hvga resolution (320x480). think because images resolution. because when use number_one.png image (124x133px) fine, if use result.png(597x90) need use dummy view see it. here code <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingleft="@dimen/activity_horizontal_margin" android:orientation="vertical" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context=".mainactivity$placeholderfragment"> <!--<textv

jquery - How do I bind Javascript events to dynamic classes -

i need generate background color change members of same class when member of class has mouseover. here's javascript: var array = ['abc','def','abc','xyz']; var row; var cell = []; var rowclass = []; (var = 0; < array.length; i++){ // insert empty <tr> element row = document.getelementbyid("mytable").insertrow(i+1); // insert cells <td></td> for(var j = 0; j < 2; j++){ cell[j] = row.insertcell(j); }; // fill cells <td></td> cell[0].innerhtml = 'row ' + i; cell[1].innerhtml = array[i]; cell[1].setattribute("class", array[i]); } var k0 = 0; rowclass[k0] = '.' + array[k0]; $(document).on('mouseover', rowclass[k0] ,function() {$(rowclass[k0]).css("background-color", "yellow");}); $(document).on('mouseout', rowclass[k0] ,function() {$(rowclass[k0]).css("background-color", "");

javascript - Prevent loss of context for 'this' variable in a function passed as a parameter -

question how can prevent loss of context this variable inside function passed parameter? simple example, in jsfiddle var = { start: function() { b.start( this.process ); }, process: function( justaparameter ) { justaparameter += ' of multiple contexts!' this.finish( justaparameter ); }, finish: function( finishparameter ) { console.log( finishparameter ); } } var b = { start: function( justafunction ) { justafunction( 'hello world' ) } } a.start(); expected output hello world of multiple contexts! received output typeerror: this.finish not function you can use bind bind value of this process() method when it's referenced argument start: function() { b.start( this.process.bind(this) ); }, fiddle

java - JOptionPane Method Not found -

here's code: import javax.swing.joptionpane; import javax.swing.*; import java.net.*; import java.*; public class icmp { public static void main(string args[]) { try { uimanager.setlookandfeel(uimanager.getsystemlookandfeelclassname()); } catch (exception e) {} int time = 0; while (true) { time = integer.parseint(joptionpane.showinputdialog("enter time")); break; } time = time * 1000; string str = joptionpane.showinputdialog("enter ip address"); try { inetaddress addr = inetaddress.getbyname(str); boolean test = addr.isreachable(time); if (test) { joptionpane.showmessagedialog(null, str + " host isconnected", "alert", joptionpane.error_message); } else { joption.showmessa

php - CodeIgnitor how to give action url for view page -

i have codeginitor system displaying products. when products view page executed through url localhost/project/index.php/product/view/102 i want add option add comment particular product in page, how can give $data['action'] = site_url('product/prodcutview'); this have tried far, didn't save value , tihnk action url not correct, please advice. function addcomment() { // set common properties $data['title'] = 'add new comment'; $data['action'] = site_url('/product/productview'); // set empty default form field values $this -> _set_fields(); // set validation properties $this -> _set_rules(); // run validation if ($this -> form_validation -> run() == false) { log_message('debug', 'comment save failed.'); } else { // save data $comment = array( 'product_id' => $this -> input -> post('product_id'

audio - iOS Remove Particular Sound from a video -

i have application plays audio , records video+audio while sound playing. figure out way process video audio picked microphone removed resulting video. for example, if i'm playing audioa, , recording videob audiob (from microphone), want somehow cancel out audioa resulting audiob, audiob ambient noise , not noise device speakers. any idea if there's way this? bonus points if can done without offline processing. you have deal playback part. here code mix selected audio recorded video. - (void)mixaudio:(avasset*)audioasset starttime:(cmtime)starttime withvideo:(nsurl*)inputurl affinetransform:(cgaffinetransform)affinetransform tourl:(nsurl*)outputurl outputfiletype:(nsstring*)outputfiletype withmaxduration:(cmtime)maxduration withcompletionblock:(void(^)(nserror *))completionblock { nserror * error = nil; avmutablecomposition * composition = [[avmutablecomposition alloc] init]; avmutablecompositiontrack * videotrackcomposition = [composition add

Adding words from form to url -

so have little problem. have url this: localhost/my/web/plan?dzien=1&mies=4&rok=2015 and it's form: <form action = "{{ app.request.getrequesturi() }}" method = "get"> <div class="input_container"> <input type="text" id="country_id" name="produkt" onkeyup="autocomplet()"> <ul id="country_list_id"></ul> </div> <div> <input type="submit" value="submit"> </div> </form> when use it, url this: localhost/my/web/plan?produkt=makaron but want add &produkt=makaron old url, this: localhost/my/web/plan?dzien=1&mies=4&rok=2015&produkt=makaron somebody have idea how can this? you can add current url paremeters form hidden input fields. <form action = "{{ app.request.getrequesturi() }}" method = "get"> &

javascript - Store DOM elements in array : strange behaviour? -

need on here. i create , than, store dom elements in array. later, when want use them, unusable, except last one. here realy simple code illustrate : http://jsfiddle.net/rd2nzk4l/ var list = new array(); // first loop create , store elements (i = 1; <= 5; i++) { var html = '<div id="test-' + + '" style="float: left; border: 2px solid black; width: 50px; height: 50px; margin: 5px;">' + + '</div>'; document.getelementbyid('test').innerhtml += html; var element = document.getelementbyid('test-' + i); //console.log(element); list.push(element); } // second loop use stored elements (index in list) { //console.log(list[ index ]); list[ index ].style.backgroundcolor = 'yellow'; } you can see last element became yellow. i'll appreciate if have idea. thanks! setting innerhtml of container recreate entire dom tr

Populating referenced collections in MongoDB from JSON files using Node.js and Mongoose -

i populating referenced collections in mongodb json files using node.js , mongoose var userschema = new schema({ username: string, sites : [{type: mongoose.schema.types.objectid, ref: 'site' }], }); var siteschema = new schema({ user : { type: string, ref: 'user' }, sitetitle: string, pages : [{type: mongoose.schema.types.objectid, ref: prefix + 'page' }], }); var pageschema = new schema({ site: { type: string, ref: 'site' }, title: string, }); exports.create = function(req, res, next) { var user = new user(req.body); user.save(function(err) { // create user if (err) { return next(err); } else { var site = new site({user: user.username, sitetitle: user.username}); site.save(function(err) { // create website if (err) { return next(err); } else { user.sites.push(site); // push site'id in sites field in user user.save(); // save user after

asp.net mvc - Identity 2 how to allow dupicate Names for logical deletes -

how can identity 2 allow more 1 user same name? in application don't want physically delete user database. have added delete flag users table. then dropped index required username unique. , created filtered index ix_user_delet_fg_flase dropindex("dbo.users", "usernameindex on dbo.user"); sql("create unique index ix_user_delet_fg_flase on dbo.users (username) deletefg = 0"); the index checks if name unique when deleted flag false. this still didn't allow me create user same name deleted user. looking @ source code identity source there private method checks if name unique. there way disable validation ? or need overwrite of identity methods check user delete flag false. has done before, lot of work or better way ? i'm afraid if start doing i'm going end down big rabbit hole you correct rabbit hole - if start digging it, you'll end lot of code purpose. easy way logical deletes append suffix end of userna

stored procedures - how to unlock locked tables explicitly in oracle -

i have master stored procedure calls multiple stored procedures write data on multiple tables, around 9-10 in 1 go. , once inserts done, there 1 commit of them. want use data concurrency , lock tables in individual sub procedures, not have commit, lock table table_name in lock_mode will work, hold table until rest of data been inserted in respective tables called after , final commit or rollback called, not idea. don't have dbms_lock opened. will locking tables in master stored procedures, or locking tables in respective sub-stored procedures option?? my master stored procedure looks procedure populate_all(p_asofdate date, p_entity varchar2) begin populate_abc_book(p_asofdate); populate_xyz(p_asofdate, p_entity); populate_def(p_asofdate, p_entity); populate_aaa(p_asofdate, p_entity); commit; exception when others rollback; p_error := sqlerrm; raise_application_error(-20001,

read.table - In R, how to read file with custom end of line (eol) -

i have text file read in r (and store in data.frame). file organized in several rows , columns. both "sep" , "eol" customized. problem: custom eol, i.e. "\t&nd" (without quotations), can't set in read.table(...) (or read.csv(...), read.csv2(...),...) nor in fread(...), , can't able find solution. i'have search here ("[r] read eol" , other don't remember) , don't find solution: 1 preprocess file changing eol (not possible in case because fields can find \n, \r, \n\r, ", ... , reason customization). thanks! you approach 2 different ways: a. if file not wide, can read desired rows using scan , split desired columns strsplit , combine data.frame . example: # provide reproducible example of file ("raw.txt" here) starting your_text <- "a~b~c!1~2~meh!4~5~wow" write(your_text,"raw.txt"); rm(your_text) eol_str = "!" # whatever character(s) rows divide on se

C# method pointer like in C++ -

this question has answer here: passing around member functions in c# 7 answers in c++ able create method pointer without knowing on instance called, in c# can't - need instance on delegate creation. this i'm looking : here code msdn using system; using system.windows.forms; public class name { private string instancename; public name(string name) { this.instancename = name; } public void displaytoconsole() { console.writeline(this.instancename); } public void displaytowindow() { messagebox.show(this.instancename); } } public class testtestdelegate { public static void main() { name testname = new name("koani"); action showmethod = testname.displaytowindow; showmethod(); } } but want : public class testtestdelegate { public static void main() { n

excel - Select specific cells for range function in openpyxl package of Python -

i have code: from openpyxl import workbook wb = workbook() ws = wb.active in range(10): ws.append([i]) this writes range(10) (0-9 values) a1 a10 . how can change these cell other cells? example b1 b10 or a1 j10 ? ws.append(seq) treats sequence or iterable passed in whole row. first value first column. if want first value column need pad sequence none . something following add 4 rows of ten values starting in fifth column. seq = [none] * 4 + list(range(10)) in range(10): ws.append(seq) for more control use ws.cell() as covered in documentation.

ajax - Auto connect user with fos user bundle / symfony 2 -

i auto connect user after subscription (my subscription method in ajax). i have : // creation of $user + setters of $user $usermanager = $this->get('fos_user.user_manager'); $usermanager->updateuser($user, true, true, true); $em->persist($user); $em->flush(); // connection of user here edit : i want in php of course , not in js new ajax request. edit 2 : i maybe find something. trying : $this->authenticateuser($user); thanks use symfony\component\security\core\authentication\token\usernamepasswordtoken; $token = new usernamepasswordtoken($user, $user->getpassword(), 'main', $user->getroles()); $context = $this->get('security.context'); $context->settoken($token);

javascript - Uncaught reference error for echo function in php -

i have used follwoing php code snippet inside java script code(inside parent html). <script> function setoptions(d) { <?php echo "test"; ?> } </script> when content saved , web page refreshed, following error, uncaught referenceerror: test not defined note- echo works when directly used inside html code. any idea on how fix problem? what want happen? when code parsed php sends browser (not valid javascript in function): <script> function setoptions(d) { test } </script> so produced needs valid javascript this: <script> function setoptions(d) { <?php echo 'alert("test");'; ?> } </script> would produce valid javascript: <script> function setoptions(d) { alert("test"); } </script>

c# - Entity Framework compare two data sets -

i have situation need compare 2 sets of data sql server. 1 set of data held in table (which modelled in entity framework model), other result set of stored procedure. fields returned stored procedure identical fields in table. i had thought following work: using (var db = new mydatabasecontext()) { dbset<mytable> tabledata = db.mytables; dbset<mytable> procdata = db.set<mytable>(); procdata.addrange(db.mytables.sqlquery("exec dbo.myproc").tolist(); if (tabledata.count != procdata.count) return false; foreach (var data in tabledata) { if (!data.equals(procdata.find(data.id))) return false; } } (side note: mytable class has been edited implement iequatable , override equals it's suitable comparing @ field level) the logic being believed db.set<mytable> create arbitrary empty set of mytable s populate result of stored procedure, , compare data in table. it appears i've misunderstood this, however

loops - Abort trap: 6 error in C -

i have code: #include<stdio.h> #include<string.h> unsigned long hash(char *str) { unsigned long hash = 5381; int c; while ((c = *str++)) hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ return hash; } int main() { char s[50],ans[50]; int max_freq = 0,num=0,hash_value,i; unsigned long int a[10000],b[10000]; file *fp = fopen("/users/brikman23/desktop/input.txt","r"); //remember specify correct path of input file.. if (fp==null) { printf("error: input file not found.."); return -1; } while(fscanf(fp,"%s",s)==1) { hash_value = hash(s); for(i=0;i<num;i++) if(a[i]==hash_value) break; if(i==num) { b[num]=1; a[num]=hash_value; if(b[num]>max_freq) { max_freq = b[num]; strcpy(ans,s); }

javascript - Alternate z-index between 2 divs on click? -

i'm not great js been using trial , error try , figure out how 2 divs swap z-index on click of trigger (button). i have 2 drawers technically on top of each other , slide out right. on click of 'buy' #quickshopdrawer should open , on click of 'cart' or 'add cart' #cartdrawer should open. link test store . my code far making open #cartdrawer on top higher z-index. js: drawer.prototype.init = function () { $(this.config.open).on('click', $.proxy(this.open, this)); $('.js-drawer-open-right-two').click(function(){ $(this).data('clicked', true); }); if($('.js-drawer-open-right-two').data('clicked')) { //clicked element, do-some-stuff $('#quickshopdrawer').css('z-index', '999'); } else { //run function 2 $('#cartdrawer').css('z-index', '999'); } this.$drawer.find(this.config.close).on('click', $.proxy(this.close, this)); }; i've tried mo

css - How to use google font offline line in polymer? -

i want use google font locally, not online. how can done in polymer? know polymer not support font-face . has 1 done before? do via <link> tag. example: <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=open+sans"/> then can use font-family: "open sans", sans-serif; edit: or, if insist on local (which don't recommend), can copy css code url of font , paste in own code. however, way more difficult , not speed-efficient.

osx - CUDA toolkit error on MAC: unable to open output file 'vectorAdd.o':, Permission denied -

i trying run cuda toolkit on mac, when compiling cuda sample programs error: unable open output file 'vectoradd.o': 'error opening output file 'vectoradd.o': permission denied' i checked environmental variables , driver installation , seems ok. do have clue problem? thanks! momir if copy whole samples folder , contents home directory, should able compile samples there without sudo . the problem directories contain sample files owned root , not writable admin users, compiler cannot create new output files , folders needs if running admin user. if want compile samples in situ (as installation guide seems suggest), can compile them using sudo . alternatively can change ownership of samples directory , subdirectories recursively: sudo chown -r your-user-name /developer/nvidia/cuda-7.0/samples

How to get return value of shell command in Mono C# -

i want know how interact shell mono , can't seem find information this. example, want return output of "ls" , stick variable - possible? here's have far: var proc = new process(); proc.startinfo.filename = "ls"; proc.start (); proc.close () it possible shell output. please try following - process p = new process(); p.startinfo = new processstartinfo("/bin/ls", "-l") { redirectstandardoutput = true, useshellexecute = false }; p.start(); p.waitforexit(); //the output of shell command in output variable after //following line executed var output = p.standardoutput.readtoend();

python - Automatically convert string to the right numerical type -

i wondering if there's elegant , easy way convert string (that know can converted number) corresponding numerical type. example, if string represents integer, want value converted int ; same long , float , , on. you use ast.literal_eval . import ast examples = ["1", "1.5", "999999999999999999999999999999999999999999", "23+42j"] item in examples: result = ast.literal_eval(item) print result print type(result) result: 1 <type 'int'> 1.5 <type 'float'> 999999999999999999999999999999999999999999 <type 'long'> (23+42j) <type 'complex'>

python - OSError: [Errno 13] Permission denied -

i new using command line , apologize in advance confusion. trying install stamp errno 13 permission denied response. found existing installation: scipy 0.13.0b1 deprecation: uninstalling distutils installed project (scipy) has been deprecated , removed in future version. due fact uninstalling distutils project partially uninstall project. uninstalling scipy-0.13.0b1: exception: traceback (most recent call last): file "/library/python/2.7/site-packages/pip-6.1.1-py2.7.egg/pip/basecommand.py", line 246, in main status = self.run(options, args) file "/library/python/2.7/site-packages/pip-6.1.1-py2.7.egg/pip/commands/install.py", line 352, in run root=options.root_path, file "/library/python/2.7/site-packages/pip-6.1.1-py2.7.egg/pip/req/req_set.py", line 687, in install requirement.uninstall(auto_confirm=true) file "/library/python/2.7/site-packages/pip-6.1.1-py2.7.egg/pip/req/req_install.py", line

objective c - UIDatePicker.date bug -

i'm having problem getting date uidatepicker. know code of getting date, keeps on getting current date, not date form picker. - (ibaction)buttonpressed:(uibutton *)sender { nsdateformatter *formate = [[nsdateformatter alloc]init]; nsdate *setteddate = self.mypickeddate.date; [formate setdateformat: @"dd.mmm.yyyy @ hh:mm:ss"]; nsstring *datestring = [formate stringfromdate:setteddate]; nslog(@"datestring: %@", datestring); } i set mypicker 15th may 2015 15:30 , xcode logs out current date (if it's 16:19 log out 22nd.apr.2015 16:19, no matter what. xcode 5.1.1 on simulator ios 7.1.2 (haven't tried on real device). the problem in viewdidload saying this: self.mypickeddate = [[uidatepicker alloc] init]; so, think code. doing there creating new date picker, different 1 in interface, , substituting 1 in interface, self.mypickeddate set (because outlet). on, self.mypickeddate refers different date picker, 1 not in interface (it

java - joda time, DateTimeFormatter -

i have following code datetimeformat = isodatetimeformat.datetimenomillis() and use datetimeformat below public static string print(date value) { return datetimeformat.print(value.gettime()); } and problem, in print method put many date instances + 4 hours time, , after datetimeformat.print(value.gettime()); time +3 hour, 1 of date instances become +4 hours, error me. in date instances has same time zone europe/moscow what may wrong in case? in date instances has same time zone europe/moscow a date instance doesn't have time zone - it's instant in time. should specify time zone formatter, e.g. datetimeformat = isodatetimeformat .datetimenomillis() .withzoneutc(); if want value does know time zone, should use datetime instead of date .

css3 - CSS images slider animation doesn't work -

i'm new here , i'll try simplify questin. i'm sorry if break rules. i'm trying simple css silde image. while i'm doing animation code, want picture fade left every link select. i'm doing video says not working. @-webkit-keyframes 'slide'{ 0% {left:-500px;} 100%{left: 0} } ul.slides li:target { z-index: 100; -webkit-animation-name: slide; -webkit-animation-duration:1s; -webkit-animation-iteration-count:1; } <!docotype html> <html> <head> <title>pure css slider</title> <link rel="stylesheet" href="file:///d:/css%20projects/css%20slider/style.css"/> </head> <body> <div id="container"> <h1>pure css slider</h1> <ul class="tumbs"> <li><a href="#slide-1"><img src="file:///d:/css%20projects/css%20slider/img/tumb1.jpg"> <span&g

ios - NSPredicate for one - to - one relashionships -

i have 2 entities 1 called game (which has boolean attribute called synchronized ) , 1 called coupon (witch has boolean attribute called won ) game , coupon connected via one-to-one relationship called hascoupon . i want fetch games have synchronized = false , won = true . nspredicate(format: "synchronized = false && hascoupon.won = true")

java - How do change file names during the execution of the program -

i have run simulations, output should in files, number of outputs can changed simulation other, example, first simulation use 10 files, second 14 files. let's have n files i declare n files using following instruction: string path1="c:/users/desktop/path1.txt"; file file1 =new file(path1); to write file 1 use function: write(my outputs list,path1,file1); during execution, according parameters, select file write on it, option without use of switch case instruction because not easy manage if number of files big. with switch case like: int choice1 = number; switch (choice1) { case 1 : write(outputs ,path1,file1); break; case 2 : write(outputs ,path2,file2); break; case 3 : ....... } i replace switch case other instruction, for example, change path, used: string path= "path"+number; where number number of path file write on it. can call function write(outputs, path, file) , same thing file, not know how. please, help.

c++ - How to create a string table -

strangely there's no online documentation on subject. have application hard coded strings ui , various other things scattered through source. i'm attempting round @ least of them because number of them need change depending on platform application compiled for. i used second example here (copied below reference) it's light on details of how should work. appears reinitialized in project_strings.cpp , code never called. // in project_strings.h namespace myprojectstrings { const char *password; ... } // project_strings.cpp strings #include "project_strings.h" namespace myprojectstrings { const char *password = "password:"; ... } // random user needs string #include "project_strings.h" std::string password(myprojectstrings::password); can explain or tell me terrible idea , should else? the example link declaring const char* s in namespace in header file , defining them in .cpp file. syntax used incorrect c++ though - decl

c# - How can I enable an "Apps for Office" app to run on a mobile browser? -

i've created "apps office" mail app that's working in both outlook 2013 desktop app , office 365 on desktop browsers. however, when use office 365 on mobile browser "app bar" never loads , therefore there's no way launch app. i've taken desktop browser mail app appeared, switched user-agent mobile browser agent, , app stops loading. according overview of apps office : apps can run in multiple environments, including office desktop applications, office online in both desktop , mobile browsers (my emphasis) , , growing number of office tablet , phone apps. what missing? set mail app outlook on desktops, tablets , mobile devices explains do. if manually edit manifest xml file you'll see <desktopsettings> element defined. you can add additional <tabletsettings> , <phonesettings> elements handle cases, optionally providing entirely different pages app.

vba - Get control of the Excel 2013 Status Bar -

i'm writing vba macro , takes time run. in every step want inform user object processed. therefor want write status bar: application.displaystatusbar = true application.statusbar = true application.statusbar = "current item: " + objname doevents but message never shown. "ready" shown. statusbar property false. application.statusbar says: property returns false if microsoft excel has control of status bar. so how can control of status bar?

beautifulsoup - How to retain &quot; and &apos; while parsing xml using bs4 python -

i using bs4 parse xml file , again write new xml file. input file: <tag1> <tag2 attr1="a1">&quot; example text &quot;</tag2> <tag3> <tag4 attr2="a2">&quot; example text &quot;</tag4> <tag5> <tag6 attr3="a3">&apos; example text &apos;</tag6> </tag5> </tag3> </tag1> script: soup = beautifulsoup(open("input.xml"), "xml") f = open("output.xml", "w") f.write(soup.encode(formatter='minimal')) f.close() output: <tag1> <tag2 attr1="a1"> " example text " </tag2> <tag3> <tag4 attr2="a2"> " example text " </tag4> <tag5> <tag6 attr3="a3"> ' example text ' </tag6> </tag5> </tag3> </tag1> i want retain &quot; , &apos; . tr