Posts

Showing posts from February, 2011

php - __call and __callStatic not working properly or writing incorrectly -

<?php class statics { private static $keyword; public static function __callstatic($name,$args){ self::$keyword = "google"; } public static function tellme(){ echo self::$keyword; } } statics::tellme(); this simple breakdown tried using __construct way write code statics::tellme(); need write new __construct work. , private static variable keyword not written without being called ideas why not working?? ide not working example private static $pathname; public function __construct($dir = "") { set_include_path(dirname($_server["document_root"])); if($dir !== "") { $dir = "/".$dir; } self::$pathname = $dir.".htaccess"; if( file_exists(self::$pathname) ) { self::$htaccess = file_get_contents($dir.".htaccess",true); self::$htaccess_array ...

postgresql - postgres function 101: returning text -

i have function this: create or replace function current_name() returns text 'select foo;' language sql; except doesn't work. neither return text "select 'foo';" how can keep written in sql, still return text? i think least change need make work. create or replace function current_name() returns text 'select ''foo''::text;' language sql; you'll see sql statement--the body of function--is string. strings have quoted, , single quotes within quoted string have escaped. have more quotation marks actual text. the usual way write use dollar quoted string constant . create or replace function current_name() returns text $$ select 'foo'::text; $$ language sql;

c++ - Make static program -

when compile program work on server, add g++ line -static flag, can run without library on external pc. there way compile way more complex source? know can add -static cflags in makefile, not enough - after trying send xdotools server via scp, ssh protocol says cannot open folder (wtf?).

c# - WPF Grid Faded in on Top of Other Grids Has Inactive Controls -

i'm experiencing unexpected behavior ui i'm working on c# wpf application. the cliffnotes version have 3 grids "inhabit" same area on form. based on toggle buttons grids enabled or disabled , faded in , out of view. however, seems in cases textboxes can used , others cannot. here style i'm applying: <!-- fade in/out style grid --> <style x:key="fadeinoutstyle" targettype="grid"> <style.triggers> <trigger property="isenabled" value="true"> <trigger.setters> <setter property="panel.zindex" value="1"/> </trigger.setters> <trigger.enteractions> <beginstoryboard> <storyboard> ...

c - Searching for a combination of characters in a file -

i trying create program reads file , searches specific combination of characters. example: "/start/ 4jy42jygsfsf /end/". so want find "strings" starting /start/ , ending /end/. in order that, use read() function because file might binary file (it doesn't have file chars). i call read() function that: #define buffsize 4000 // more declarations while (read(file_descriptor, buffer, buffsize) > 0) { //search /start/ //then search /end/ //build string chars between these 2 //keep searching till reach end of buffer } assume every /start/ followed /end/. the question is: how deal cases combination of characters cut in half? for example, let's first time read() gets called, in end of buffer spot /star , next time read() gets called @ start of second buffer there t/ 4jy42jygsfsf /end/ . this combination might cut anywhere. solutions thought result many many lines of code. there smart way deal these cases? when rea...

php - What does session_register_shutdown actually do? -

from official php manual: session_register_shutdown — session shutdown function registers session_write_close() shutdown function. so, session shutdown mean? what's difference between session_write_close , this? to make clear, function do? when shall use it? it seems few people using , talking function on web. this function used actually, there no discussion on internet, found answer source code comments: /* function registered shutdown function * session_set_save_handler($obj). reason register * shutdown function in case user registered own shutdown * function after calling session_set_save_handler(), expects * session still available. from: https://github.com/php/php-src/blob/master/ext/session/session.c and, obviously, compared official manual, states do. this question looks silly.

javascript - Add safe HTML inside unsafe string appended with .text() -

so if have unsafe string: '<div id='unsafe'></div> unsafe2 <div id='unsafe3'></div>' safely appended (or going appended) inside div container via div.text(str) , how can safely , efficiently replace middle part of string - unsafe2 (or few separate parts in bigger string) trusted html (let's inline-block element ), displayed html, i.e final display inside container must this: ___ <div id='unsafe'></div> |___| <div id='unsafe3'></div> edit: assuming know how find unsafe2 inside string. question of proper , safe replacement 1 bothers me. edit2: here's simple fiddle: https://jsfiddle.net/5pa7do7w/ type containing word doggy ( hello doggy, i'm here! ) , hit enter, assume unsafe string came other user's end. in 'chat' field doggy replaced colored span doggy . easy do, using .html(str) , approach if input unsafe string <script...

PHP & MYSQL password_verify issue -

basically. having problem decrypting passwords.this dummy project , done in mysql (i understand depreciated, learning mysqli & pdo currently). i can hash password perfectly, so: $password = password_hash("$password1", password_default); $password = substr( $hash, 0, 60 ); my database password field set char(255) stumped.. have password_verify running so: // define $username , $password if (isset($_post["action"]) && $_post["action"]=="login") { $username =$_post["username"]; $password =$_post["password"]; // sql query fetch information of registered users , finds user match. //searches table username , password matching post data $dbquery = "select * users username = '$username';"; $dbresult = mysql_query($dbquery); $dbrow=mysql_fetch_array($dbresult); $username = $dbrow["username"]; // checks if user exists sql if(mysql_num_rows($d...

vector - C++ : why is my average returning as an int and not a double? -

this question has answer here: c++ std::accumulate doesn't give expected sum 5 answers i declared average double @ beginning of int main(). code compiles , runs fine, except when calculates average returns int. goal of assignment create , fill vector, calculate average , find median. stuck on part. ideas?? thanks , appreciate help. #include <iostream> #include <vector> #include <cmath> #include <numeric> using namespace std; int main() { int n; double average=0; cout<<"vector length?: "<<endl; cin>>n; vector<int> data; srand(time(null)); (int i=0; i<n; i++) { data.push_back(rand()%10+1); } (int i=0; i<data.size(); i++) { cout<<"vector: "<<i<<" "<< data[i]<<endl; } average = ac...

ruby - How do I open a new XLSX file in roo? -

this code: newbook = roo::excelx.new('./test.xlsx') gives me error: c:/ruby193/lib/ruby/gems/1.9.1/gems/roo-1.13.2/lib/roo/excelx.rb:85:in `block in initialize': file ./test.xlsx not exist (ioerror) why? how make new xlsx file ruby's roo gem? roo meant reading excel files only. recommend axlsx gem. it can used in pure ruby follows require 'axslx' package = axlsx::package.new workbook = package.workbook workbook.add_worksheet(name: 'some sheet name') |sheet| sheet.add_row ["header 1", "header 2", "header 3"] sheet.add_row ["data 1", "data 2", "data 3"] end package.serialize('./test.xlsx') this create spreadsheet looks like -------------------------------- | header 1 | header 2 | header 3 | -------------------------------- | data 1 | data 2 | data 3 | axlsx offers pretty can in excel including styling , conditional styling. hope helps out. ...

client - Server not recieving message - Java -

i have server , client in server ui, have 3 jlabel using mouseclick communicate indiviual clients connected server. when click on jlabel1 messsage going client1 when client1 recieves message should respond not responding server when recieves message it. hope guide me whats wrong code. //server void connect_clients() { try { serversocket listener = new serversocket(7700); jbutton1.settext("server running!"); jbutton1.setenabled(false); while (true) { socket = listener.accept(); socketlist.add(socket); //recieve method client come here. } } catch(ioexception ex) { joptionpane.showmessagedialog(null, "5"+ex); } } *******here when click jlabel1,message goign 1st client ,it should respond on seeing message client. not.**** private void jlabel1mouseclicked(java.awt.event...

arrays - How to open a text file as a character matrix in python? -

i have .fa file contains list of secuences of nucleotids. this agctagagagactagactaga gatcagtacatgatctaggat gatagtacatgggggatagac i need somehow open file in python , make 2-dim array contains rows lines of .fa file , in each column letter of file. help!!!! if interested in having matrix list of lists, can list comprehension. with open("myfile.fa","rt") infile: matrix = [list(line.strip()) line in infile.readlines()] print matrix if, on other hand, prefer have numpy matrix (note requires have installed numpy ): import numpy open("myfile.fa","rt") infile: matrix = numpy.matrix([list(line.strip()) line in infile.readlines()]) print matrix

c++ dynamic array Floating Point exception -

for homework had design arraylist in c++ using 1d arrays , pointers make array dynamic. have done ample testing , functions work correctly, when use main teacher has provided me floating point error. point of homework create class work teachers main without changing code in main here main: #include "arraylist.h" #include <iostream> using namespace std; int main(int argc,char *argv[]) { arraylist arr; (int i=1;i<=50;i++) { arr.push_back(i); } cout << "should contain numbers 1..50, "; cout << arr.tostring() << endl; (int i=arr.size()-1;i>=1;i--) { arr.erase(arr[i]); } cout << "should contain 1, "; cout << arr.tostring() << endl; arr.erase(arr[0]); (int i=1;i<=50;i++) { if (i<=2) arr.push_back(i); else { int j=1; while ((j<arr.size()) && (i%arr[j]...

c++ - Faster 16bit multiplication algorithm for 8-bit MCU -

i'm searching algorithm multiply 2 integer numbers better 1 below. have idea that? (the mcu - @ tiny 84/85 or similar - code runs has no mul/div operator) uint16_t umul16_(uint16_t a, uint16_t b) { uint16_t res=0; while (b) { if ( (b & 1) ) res+=a; b>>=1; a+=a; } return res; } this algorithm, when compiled @ tiny 85/84 using avr-gcc compiler, identical algorithm __mulhi3 avr-gcc generates. avr-gcc algorithm: 00000106 <__mulhi3>: 106: 00 24 eor r0, r0 108: 55 27 eor r21, r21 10a: 04 c0 rjmp .+8 ; 0x114 <__mulhi3+0xe> 10c: 08 0e add r0, r24 10e: 59 1f adc r21, r25 110: 88 0f add r24, r24 112: 99 1f adc r25, r25 114: 00 97 sbiw r24, 0x00 ; 0 116: 29 f0 breq .+10 ; 0x122 <__mulhi3+0x1c> 118: 76 95 lsr r23 11a: 67 95 ror r22 11...

c# - Is there a way to detect incoming Skype calls? -

i working on app detect when main skype app receives call. is there way monitor skype , detect when there incoming call? skype4com still thing (at least have seen official skype rep's respond on usage earlier year), available download , still semi-supported. far know can use skype4com (c#) connect skype , read call status etc. features of skype4com have been deprecated far know, call status isn't 1 of them latest skype4com (direct download)

SQL SERVER PIVOT TABLE One Row -

i have table e.g. pay staff amount tax 1 40 10.00 1.5 1 40 20.00 3.0 1 40 15.00 2.0 i want output table e.g. pay staff amount1 tax1 amount2 tax2 amount3 tax3 1 40 10 1.5 20 3.0 15.00 2.0 how please? you can using dynamic crosstab. read article jeff moden reference: sql fiddle declare @sql1 varchar(4000) = '' declare @sql2 varchar(4000) = '' declare @sql3 varchar(4000) = '' select @sql1 = 'select pay , staff ' select @sql2 = @sql2 + ' , max(case when rn = ' + convert(varchar(4), rn) + ' amount end) [amount' + convert(varchar(4), rn) + ']' + char(10) + ' , max(case when rn = ' + convert(varchar(4), rn) + ' tax end) [tax' + convert(varchar(4), rn) + ']' + char(10) from( select distinct row_number() over(order (select null)) rn yourtable )t select @sql3...

How to create a scala function that returns the number of even values in an array? -

i'm attempting create function returns number of values in array. far have following code, it's not working: (a: array[int]): int = { var howmanyeven = 0 for(i <-0 a.length) { if(a(i)%2==0){ howmanyeven+= 1 } howmanyeven } in addition, reason i'm stumped how return number of odd values in array. methods off? guess i'm stumped methods use generate desired output. you have off-by-one error (ignoring other typos , missing information), in you're trying go 0 a.length . if length 10, you're going 0 10, 11 indices. should a.length - 1 . you avoid having reason off-by-one errors using functional approach. same thing can accomplished in 1 line using standard methods in collections library. def howmanyeven(a: array[int]): int = a.count(_ % 2 == 0) scala> howmanyeven(array(1, 2, 3, 4, 6, 8, 9, 10, 11)) res1: int = 5 count method in collections library counts elements in collection satisfy boolean property. in case, ...

html - How do I get two adjacent spans to display their text vertically? -

so have html <div class="container"> <div class="jumbotron"> <div class="row"> <div class="col-xs-6"> <span class="currency-symbol">$</span><span class="price">44</span> </div> <div class="col-xs-6"> <p>/ month</p> <p>here interesting things product.</p> </div> </div> </div> </div> and css .container { width: 333px; margin: 0 auto; } .currency-symbol { vertical-align: top; font-size: 33px; } .price { font-size: 88px; vertical-align: top; /* doesn't work */ } the '$' symbol aligns top text in rh column. price amount doesn't. how vertically align '$' symbol, '44' amount , text in rh column they're in line? jsfiddle here: http://jsfiddl...

How to Dynamically Create Variables in MATLAB -

i manipulate variables names. (just in php use ${} create dynamic variables). exemple: i want create n variables a_n name: for = 1:n a_i = 'new variable!'; end the result be: a_1 a_2 ... a_n if want create variables programmatically (not recommended practice, if insist), see previous question: a way dynamically create variables in matlab? . as say, it's messy that, , @ least may want have things stored within structure, allows programmatic creation of elements using string variables , dynamic referencing using paren syntax. instance, in example, use: n = 5; = 1:n fieldname = sprintf('a_%i', i); s.(fieldname) = 'new variable!'; end if display structure s , see: >> s s = a_1: 'new variable!' a_2: 'new variable!' a_3: 'new variable!' a_4: 'new variable!' a_5: 'new variable!'

MySQL adding (num) to smallint column -

when create table in mysql specifying smallint column, use show create table or mysqldump, mysql has added (5) after smallint definition, below. i'm guessing doesn't matter far data concerned, can explain why , if/how can stop doing this? as aside, attempting change existing database table exactly match of new sql script. alter new sql script, i'd prefer alter existing table if possible (think software install versus software upgrade). drop table if exists `test`; create table `test` ( `id` int(10) unsigned not null auto_increment, `status` varchar(100) not null default '', `port` smallint unsigned not null default '0', primary key (`id`) ) engine=innodb default charset=utf8; show create table test; create table `test` ( `id` int(10) unsigned not null auto_increment, `status` varchar(100) not null default '', `port` smallint(5) unsigned not null default '0', primary key (`id`) ) engine=innodb default charset=utf8...

java - JAXB marshalling to XML - Is there a way to handle it when Schema validation fails? -

i using jaxb in order marshall/unmarshall objects xml file small service want implement. right now, have xml schema (.xsd file) includes unique constraints: <!--....--> <xs:unique name="uniquevalueid"> <xs:selector xpath="entry/value"/> <xs:field xpath="id"/> </xs:unique> <!--....--> i have loaded xml schema marshaller object: try { //.... //set schema onto marshaller object schemafactory sf = schemafactory.newinstance(xmlconstants.w3c_xml_schema_ns_uri); schema schema = sf.newschema(new file(xsdfilename)); jaxbmarshaller.setproperty(marshaller.jaxb_formatted_output, true); jaxbmarshaller.setschema(schema); //apply marshalling here jaxbmarshaller.marshal(myobjecttomarshall, new file(xmlfilenname)); } catch (jaxbexception | saxexception ex) { //exception handling code here.... } when schema valid target file updated normally, when validation fails, file emptied or incomplete data. i guessing ...

How to store the value from radiobuttonlist to database in C# ASP.NET -

i need in storing values radiobuttonlist sql server 2008. code works fine when checked in database if values radiobuttonlist have been stored there's nothing in database. asp.net <p> hypertension<asp:radiobuttonlist id="radiobuttonlist1" repeatcolumns ="2" repeatdirection = "vertical" repeatlayout= "table" runat="server" autopostback="true" onselectedindexchanged="radiobuttonlist1_selectedindexchanged" width="250px" height="10px" style="margin-left: 0px" borderstyle="none" cellpadding="1" cellspacing="1"> <asp:listitem value="rbtrue">true</asp:listitem> <asp:listitem selected="true" value="rbfalse">false</asp:listitem> </asp:radiobuttonlist> </p> in c#: prote...

android - Espresso onData perform click on multiple items -

i have gridview adapter based on list of pojos of type tile minesweeper game, im doing unit tests , want click on gridview items dont have mines , longclick items have items i have tried following: ondata(allof(is(instanceof(tile.class)),isminematcher(true))) .inadapterview(withid(r.id.f_minefield_gridview)) .perform(longclick()); ondata(allof(is(instanceof(tile.class)),isminematcher(false))) .inadapterview(withid(r.id.f_minefield_gridview)) .perform(click()); with custom matcher: public static matcher<tile> isminematcher(final boolean flag){ return new typesafematcher<tile>() { @override public boolean matchessafely(tile tile) { return tile.ismine() == flag; } @override public void describeto(description description) { description.appendtext("expected "+ flag); } }; } but presents following error: android.support.test.e...

Listing plugin updates for new Grails 3.0 application -

a lot has changed grails 3.0 . how run list-plugin-updates application? the command used work me results in error. $ grails -version | grails version: 3.0.1 | groovy version: 2.4.3 | jvm version: 1.8.0_45 $ uname -sr darwin 14.3.0 $ $ grails list-plugin-updates | error command not found list-plugin-updates did mean: list-plugins or plugin-info or test? the documentation implies command should still work: http://grails.github.io/grails-doc/3.0.x/ref/command%20line/list-plugin-updates.html plugins grails 3.0 have moved on bintray: https://bintray.com/grails/plugins grails uses gradle dependency resolution , way plugins identified has changed. example of using less plugin under grails 3.0: http://davydotcom.com/blog/2015-01-29-grails-3-0-0-m1-asset-pipeline-tips-tricks it seems list-plugin-updates command no longer applicable.

C++ sort linked list in ascending order -

this code.i wondering why doesn't work. sll_node *sortlist(sll_node *head) { int temp=head->value; if(head!=null||temp>head->next->value) { head->value=head->next->value; head->next->value=temp; } else { sortlist(head->next); sortlist(head->next->next); sortlist(head->next); } return head; } the main problem in code have shown using pointers before knowing if valid. so before can assign temp head->value or use head->next, have make sure head not equal null. before use head->next->value or head->next->next, have make sure head->next not equal null. try this: sll_node *sortlist(sll_node *head) { if(head != null) { int temp=head->value; if (head->next != null) { if (temp > head->next->value) { head->value=head->next->value; head->next->value=temp; ...

BAT or VBS to edit existing xml file -

i after code either bat or vbs add line existing xml file… example of existing xml; <?xml version="1.0" encoding="utf-8"?> <feature> <feature #1001> <feature #22002> <feature> example of wanting insert “feature #0000” below; <?xml version="1.0" encoding="utf-8"?> <feature> <feature #0000> <feature #1001> <feature #22002> <feature> the existing xml file have varying content thinking looks first “<feature>” inserts directly line after regardless follows after. any idea appreciated! in opinion vbs better can manager spaces , linebreaks, special characters... in bat it's gonna little bit difficult know doing (like adding spaces), vbs has features searching strings, replacing, selecting... bat far know doesn't have these ones. note : simple problem using vbs putting " character using chr(34) & "your text...

Chroot directory limit user to sftp folder -

my current setup works: sshd_config file: subsystem sftp internal-sftp match group filetransfer2 chrootdirectory %h x11forwarding no allowtcpforwarding no forcecommand internal-sftp linux commands ran: addgroup --system filetransfer usermod -g filetransfer username chown root:root /home/username chmod 755 /home/username cd /home/username mkdir docs public_html chown username:filetransfer * and username restricted /home/username folder , works perfectly. try limit username to: /home/somefolder/public/domain.com/ when use sudo usermod --home username /home/somefolder/public/domain.com/ changes default directory of username when logged in sftp. although refuses login. i've tried above steps while using /home/somefolder/public/domain.com/ without luck, refuses login sftp. i have give support desk sftp login , don't want give them root login details , therefor want limit them domain.com folder. what doing wrong? thanks for chroot work ...

javascript - Populating an array of objects with a loop -

i'm trying loop through number of items, , create array. each loop should new item in array, i'm having issues doing it. seems 1 set of items gets added, instead of multiple ones. i've tried below code. please me solve it. function openpopup3(src,type,title){ var mydata = []; rows.each(function(index) { var temp_obj = {}; temp_obj["src"] = $this.find('.elementone').text(), temp_obj["type"] = $this.find('.elementtwo').text(), temp_obj["title"] = $this.find('.elementthree').text() mydata.push(temp_obj); }); $.magnificpopup.open({ key: 'my-popup', items: mydata, type: 'inline', inline: { markup: '<div class=""><div class="mfp-close"></div>'+'<img class="mfp-src">'+'<div class="mfp-title"></div>'+'</div>' }, gallery: { enabled: true } }); ...

ios - Invalid update: invalid number of rows in section -

i working on project using microsoft azure services . in while deleting row getting error: terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'invalid update: invalid number of rows in section 0. number of rows contained in existing section after update (2) must equal number of rows contained in section before update (2), plus or minus number of rows inserted or deleted section (0 inserted, 1 deleted) , plus or minus number of rows moved or out of section (0 moved in, 0 moved out). code table load , delete row : - (nsinteger)numberofsectionsintableview:(uitableview *)tableview { return 3; } - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { //medicine list if (section == 0) { nsarray *sectioninfo = [self.fetchedresultscontroller1 fetchedobjects]; return [sectioninfo count]; } //allergy list else if (section == 1) { nsarray *sectioninfo = ...

masm - Assembly Language program stuck in an infinite loop -

my program seems stuck in loop after program prompts user input paragraph. title csc221a4 (csc2214.asm) include irvine32.inc .data mainmenu1 byte " ", 0ah, 0ah, 0ah byte " main menu ", 0ah byte " 1. count , display number of characters (press 1) ", 0ah, 0ah byte " 2. count , display number of words (press 2) ", 0ah, 0ah byte " 3. count , display number of sentences (press 3) ", 0ah, 0ah byte " 4. count , display numbers of letters equal 'n' or 'n' (press 4)", 0ah, 0ah byte " 5. count , display number of capital letters (press 5) ", 0ah, 0ah byte " 6. count , display number of vowels (press 6) ", 0ah, 0ah prompt1 byte " ", 0ah, 0ah byte "please enter paragraph. press $ end.",0ah, 0ah, 0 prompt2 byte " ", 0a...

copying files from server to local automatically using batch command -

i want copy particular logfile generated each day in 1 of server have access local daily automatically. i prepared batch commands follows didn't work expected. echo off set logfiles=\\pwwas0015\ums_logs\server1\ums\service-*.log rem set var = c:\users\l068699\desktop\test\src echo %logfiles% copy %logfiles% c:\users\l068699\desktop\test\ set yesterday = [datetime]::today.adddays(-1).tostring("yymmdd") echo %yesterday% pause the problem cana ble extract logs couldn't log service-2015-04-17.log. how can extract kind of log 1 day behind i.e. if today 2015-04-24 should previous day log file service-2015-04-23.log try this: pushd \\pwwas0015\ums_logs\server1\ums\ rem set var = c:\users\l068699\desktop\test\src ::echo service-*.log /f "usebackq" %%a in (`"powershell (get-date).adddays(-1).tostring('yyyy-mm-dd')"`) set yesterday=%%a echo %yesterday% copy service-%yesterday%.log c:\users\l068699\desktop\test\ pause eve...

regex - PHP Variable to Wordpress shop page -

i have link: http://www.ignitionmarketing.co.za/products_promodc.php?product_category=corporate+gifts i be: http://www.ignitionmarketing.co.za/product-category/corporate-gifts/ also have tried normal way of: redirect 301 /products_promodc.php?product_category=corporate+gifts http://www.ignitionmarketing.co.za/product-category/corporate-gifts/ but still stays on 404 page. could please me? added note: i have couple of other links need redirected like: /products_promodc.php?product_category=corporate+clothing /products_promodc.php?product_category=corporate+clothing&product_subcategory=shirts the new wordpress shop have same categories well. just better explanation solution. maybe come across similar issue in future. i redirected "products_promodc.php" /product-category/ variable/parameter loaded behind (/product-category/corporate+clothing/) still gave me 404 error because of plus (+) within url. wrote rewriterule convert pluses (+) das...

c# - How to add functionality of treatment to my own linked list -

my question add treat foreach own linked list. created linked list seeing example here and want add linq linked list. can see it? or how can implement it? you need implement ienumerabe<object> inside linkedlist class: public class linkedlist : ienumerable<object> { // code // .... public ienumerator<object> getenumerator() { var current = this.head; while (current != null) { yield return current.data; current = current.next; } } ienumerator ienumerable.getenumerator() { return this.getenumerator(); } } then, linq work: var result = mylinkedlist.where(data => /* condition */) .select(data => data.tostring(); as far ienumerable implementation lazy evaluted ( yield return ) want throw exception when list modified while itering (to prevent bugs or sth): pub...

linux - Apache RewriteEngine On causes 403 error -

i have linux box running centos 6.6 apaches 2.2.x unknown reason, turning on rewrite engine causes 403 error (this happens whether add rewrite rule or not). i have spent hours researching , have made changes config in accordance advice have found in many places, still got nowhere. currently in .htaccess have this: <ifmodule mod_rewrite.c> options +followsymlinks rewriteengine on </ifmodule> in directives virtual host, have this: documentroot /var/www/html/example.uk <directory /var/www/html/example.uk> options indexes followsymlinks multiviews allowoverride order allow,deny allow </directory> servername example.uk serveralias www.example.uk (this seems work in debian box, not centos machine.) in httpd.conf have changed allowoverride none to allowoverride my httpd.conf contains loadmodule rewrite_module modules/mod_rewrite.so error log says: options followsymlinks or symlinksifownermatch off implies rew...

How to load <list> data into dataGridView in c# -

i have rows , columns datagridview in c# widows form application. how can display data `datagridview..whole data in list. now, want load list datagridview.. new c# , appreciate help. in question didn't mention type of list use. try using data table. datatable dt = new datatable(); dt.columns.add("firstname"); dt.columns.add("lastname"); foreach(var oitem in yourlist) { dt.rows.add(new object[] { oitem.firstname, oitem.lastname }); } mydatagridview.datasource = dt;

Identity certificate - IOS MDM -

i have few questions regarding identity certificate in profile payload. forgive ignorance, if questions basic. 1.) found that, can either use scep standard or pkcs12 certificate directly device identification. scep recommended, since private key known device. in case if going implement scep server, need maintain list of public key of identity certificates mapped device, can use later encrypting? 2.) best possible way implement scep server.? there reliable robust methods available adopt instead of writing on our own? 3.) if identity certificate expired? as basic version while playing around, tried add own p12 certificate payload without using scep. i tried add base64 encoded p12 certificate in identity payloadcontent key,as mentioned in link reference. got error the identity certificate “test mdm profile” not found while installing profile. identity_payload['payloadtype'] = 'com.apple.security.pkcs12' identity_payload['payloaduuid'] ...

linux - Undefined variable in shell script by using ssh -

i use shell script run r program following: host_list="server@com" directory="/home/program/" ssh -f "$host_list" 'cd $directory && nohup rscript l_1.r> l_1_sh.txt' but says directory: undefined variable. ssh not propagate environment variables. you're setting on environment of local client ssh program, not on server side. hack, stick inside commands ssh running remotely, instead of pre-command environment setup. host_list="server@com" ssh -f "$host_list" 'directory="/home/program/"; cd "$directory" && nohup ...' here's simpler version of command let test without depending on particular program setup. ssh localhost dir="/etc"; echo dir "$dir"; cd "$dir" && pwd && ps