Posts

Showing posts from July, 2015

php - Arrange parent-child relationship -

i have read build tree flat array in php , convert series of parent-child relationships hierarchical tree? not figure out how implement problem. there pairs of relations such: array ( [0] => catalog.iden = catalog_sub.parent [1] => catalog.group = catalog_group.iden [2] => catalog_photo.iiden = catalog.iden ) i have not null, or 0, or explicit condition stop looping. know field has primary key auto_increment attribute. in example field named 'iden' in relation "parent". i have spent week resolve problem no result. me arrange array in order of relations. may tree of flat array. thanks in advance. update so far managed so: foreach($matches[0] &$match) { $ref = explode('=', $match); // split = sign $lft = explode('.', $ref[0]); $rgt = explode('.', $ref[1]); if($lft[1] == 'iden') { $arr[$lft[0]][$rgt[0]] = $rgt[1]; } else { $arr[$rgt[0]][$lft[0]] = $lft[1]; ...

haskell - narrowing type of a vinyl record based on the lens/index chosen -

extensible records provided http://hackage.haskell.org/package/vinyl different other libraries (hlist , others grapefruit-records/records) provide. because result of lookup based on pair (result type, label) , while other libraries have lookup based on label only. example of happening vinyl: {-# language datakinds, typeoperators #-} import data.vinyl r = fixrecord $ (field :: "x" ::: a) =: (3::double) <+> (field :: "x" ::: a) =: (2::int) main = print $ rget (field :: "x" ::: int) r print $ rget (field :: "x" ::: double) r -- prints 2\n3 for application http://hackage.haskell.org/package/rlang-qq , type of elements of record determined usage later on, seems need "x" uniquely determine value that's stored there. i want avoid "redundant" type signature in expression (rget (field :: "z" ::: [double]) (ans :: plainrec ("z" ::: [double] ': '[]))) and have more...

c# - LinqToSQL - ToList() appears to be very slow -

i'm newish linqtosql , project working on cannot changed else. translating old sql code linq. not being hot @ linq, used linqer translation me. query took 90 seconds run, thought must linqtosql. however, when copied query linqtosql produced , ran executequery on datacontext super quick expected. i've copied full queries, rather trying distil down, looks issue linqtosql doing behind scenes. to summarise, if copy t-sql created linq , run var results = db.executequery<invoicebalancecheckdto.invoicebalancecheck>(@"t-sql created linq - see below").tolist() it completes expected results in 0.5 seconds. runs same time directly in ssms. however, if use linqtosql code creates t-sql , tolist() takes ages. result 9 records, although without constraint check balance <> 0, there around 19,000 records. it's if it's getting 19,000 , checking <> 0 after it's got records. have changed linq project class used above, rather anonymous type, makes n...

c# - Keep page contents while post back -

when ever postback page blanked, have seen pages, page not being blank while post back can give me idea how can done thank you private void page_load() { if (ispostback) { // postback } else { // not postback } } refer link http://msdn.microsoft.com/en-us/library/system.web.ui.page.ispostback.aspx

search - Searching a custom listview using an ArrayAdapter in Android -

i have custom listview has 2 textviews , 1 imageview in it. uses custom arrayadapter it's adapter, , wanted add search function it. i've looked through every single tutorial find, no luck. 1 tutorial able search through regular listview (not using custom adapter), not work me because need show both textviews , imageview. need filter 1 of textviews though, don't see how trouble be. anyway, here mainactivity: public class itemid extends activity { // list view private listview lv; // listview adapter arrayadapter<string> adapter; // search edittext edittext inputsearch; // arraylist listview arraylist<hashmap<string, string>> productlist; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.testo); context ctx = getapplication(); resources res = ctx.getresources(); string[] options = res.getstringa...

class - Windows Phone Classes with same name but different folders -

i have 2 auto-generated classes generated xsd tool. the classes have same name , similar member variables. but many of members different. i storing these classes in different folders. there still conflict - this the type 'response' contains definition 'field1' how store these classes avoid conflict?? i don't want change in classes auto-generated , changing them might cause xml parsing errors the classes have structure below:- public partial class response { public string field1; public string field2; public string field3; } public partial class response { public string field1; public string field2; public string field4; } the classes stored follows myproject->classes->folder1->class1 myproject->classes->folder2->class2 if entire class autogenerated visual studio (and not touched/moved afterwards), classes have different namespaces namespaces derived folder names. different namespaces shouldn't have ...

How to get the confidence of HaarDetection in python openCV 2.0 -

the old version of opencv returned number of neighbors detected, , used measure of confidence. for example: cv.haardetectobjects(grayscale, cascade, storage, 1.2, 2, cv.cv_haar_do_canny_pruning, (50,50)) [((174, 54, 114, 114), 53)] the new version of opencv changed signature used, either detectmultiscale(image[, scalefactor[, minneighbors[, flags[, minsize[, maxsize]]]]]) -> objects or detectmultiscale(image, rejectlevels, levelweights[, scalefactor[, minneighbors[, flags[, minsize[, maxsize[, outputrejectlevels]]]]]]) -> objects the second signature has rejectlevels , levelweights which, understanding, can used confidence. this reflection of c++ version of functions. but, unclear me how pass parameters changed in python. i've tried, example, following, not change r , w : r = list() w = list() res = cascade2.detectmultiscale(image=img, rejectlevels=r, levelweights=w) print res print r, w [[ 82 158 53 53] [175 157 52 52] [103 266 112 112]] ...

c# - How to submit changes in LinqPad -

i have problem committing changes in linqpad. using oracle database on iq driver in linqpad. can retrieve data don't know how submit changes database. i retrieve data database: var items = asyncqueue.where(x => ids.any(y=> y == x.asyncqueueid)); // have fix data i have tried set submit action this: asyncqueue.setsubmitaction(items, submitaction.update); change language in linqpad "c# program" , use following code void main() { var p1 = person.single(x => x.id == 1); p1.name = "test"; savechanges(); }

windows 7 - Cannot see what I am typing in telnet -

i enabled telnet in widows 7 , when type in cmd: telnet www.example.com 80 screen clears , cannot see typing. although can trace cursor moves every character typed. saw link relevant. however, when type / http/1.0 nothing happens , when press ctrl+] not accept / http/1.0. should see page? try this: telnet set localecho open <host ip> <port> see this question

perl - call function while reading STDIN -

i use term::readline::gnu, try use event_loop, or event_hook, or callback_read_char attribute without success. with event_loop, try sample in doc $term->event_loop(sub { $data = shift; $data->[1] = ae::cv(); $data->[1]->recv(); }, sub { $fh = shift; $data = []; $data->[0] = ae::io($fh, 0, sub { $data->[1]->send() }); $data; }); and have: cannot `event_loop' in term::readline::gnu event_hook works not want...it's called during waiting not when char printed. i don't found how use callback_read_char attribute , if meets needs... so, how check input (to print digit) , limit input length 10 digits? how can this? or have use module? this wanted: #!/usr/bin/perl -w use strict; use warnings; use term::screen::readline; use data::dumper; main(); sub main { $| =1 ; $scr = new term::screen::readline; $scr->clrscr(); $scr->at(1,17)->puts('xxxxx...

c# - Convert input file or stream to UTF8 and detect if it's UTF8 or not (asp.net) -

what best way in c#/asp.net following: - detect if file reliably utf8 or not; - convert input stream or file on disk utf8 programmatically. cheers askar for checking if stream utf8 see: http://utf8checker.codeplex.com/ for converting can use streamreader: new streamreader(stream, encoding.utf8)) in fact, using contructor prevents previous check, can use it. msdn: the character encoding set encoding parameter, , buffer size set 1024 bytes. streamreader object attempts detect encoding looking @ first 3 bytes of stream. automatically recognizes utf-8, little-endian unicode, , big-endian unicode text if file starts appropriate byte order marks. otherwise, user-provided encoding used. see encoding.getpreamble method more information. if wish not detect little-endian unicode , big-endian unicode call following contructor: new streamreader(stream, encoding.utf8, false)) the false turn off encoding detection, , call allways encode file using ut...

d3.js - D3 collapsible tree, change colour of knots and avoid line/text overlap -

so here d3 tree: http://plnkr.co/edit/hwczecztlor51cynsgsl?p=preview as may see, tree bit complex , of leave names may quite long. main questions are: can change colour of specific knots (some blue, red) , there way can make text of leave not overlap link previous level? happens when link straight line. my js skills lacking least these baby steps world , appreciated. thanks! the answer first question easy. colour of node set in line 90 in example -- .style("fill", function(d) { return d._children ? "lightsteelblue" : "#fff"; }); to change colour, need adapt line. in function returns colour, have access data bind nodes, can use of data attributes decide colour. note fill colour set here , not outline stroke colour, add .style("stroke", ...) . the answer second question more complex. functionality you're asking not built in d3, have yourself. note quite complex thing because have figure out positions , bounding boxe...

c++ - the efficient algorithm for finding the area of polygon -

i looking best (efficient algorithm calculating area of 2d polygon (especially triangle given 3 points ). search on web , found following link, still i'm not sure efficient in terms of memory cost or not (since mesh huge). wondering if there tricks in c++ (i'm newbie in c++) applied on them: here links: (stackoverflow) how determine if point in 2d triangle? http://www.softwareandfinance.com/visual_cpp/triangle_area_perimeter.html it's worth mention final target find out if point inside (not on border) polygon. thanks help. joachim pileborg suggested in comments area isn't needed, misses point: there's efficient algorithm require intermediate value, happens 2*area . however, in case problem input domain: mesh of triangles. means every vertex borders on 2 triangles. it's not "point p lies on left of edge e, it's not in triangle t". there large set of triangles t i , of lie on left, of lie on right, , 1 directly on either side...

unicode - Zero width caret navigation UTF8 character -

is there such character, text-cursor/caret-navigation, 1 blinks when focusing text-areas? zero-width char of vertical line? no. it's trivial shape recognize, , yet shapecatcher doesn't find close. it's not character you'd expect in document, either. there dubious non-character code points in unicode, exist compatibility legacy encodings. , i'm not familiar legacy code set encoded that.

asp.net - how to change data in the column as "N" automatically instead of deleting, after selecting the checkbox &click on delete button -

when inserting record table, in "state" column inserting "a". want automatically change "a" "n" after have checked checkbox , clicked on delete button. can please me? string constr = configurationmanager.connectionstrings["webconnectionstring"].connectionstring; protected void btndelete_click(object sender, eventargs e) { foreach (gridviewrow row in gridview1.rows) { checkbox chk = (checkbox)row.findcontrol("chkselect"); if (chk.checked == true) { int cnt= int.parse(gridview1.datakeys[row.rowindex].value.tostring()); sqlconnection con = new sqlconnection(constr); string sql = "delete pa_webwork sno = @sno "; sqlcommand cmd = new sqlcommand(sql, con); cmd.parameters.addwithvalue("@sno", cnt); con.open(); cmd.executenonquery(); con.close(); } } gridview1.databind...

How to capture the exit code of a shell script in a perl script? -

i want pop alert box using perl script. using exit 0 terminate shell script , exit 1 terminate shell script when error occurs. want capture exit code in perl script. , depending on value 0 or 1, want pop alert box success or failure message respectively. you can check exit code of process child error variable $? . example: system("perl foo.pl"); $exit_val = $? >> 8; # contains exit value of perl script read documentation more info.

plsql - Oracle: Rollback only crash iteration of loop -

i need accomplish rollback on iteration if 1 or more iterations crash , commit others iteration if success. if crash, rollback whole transaction. think can done savepoints, i'm not familiar them. basic example try achieve. declare ... begin in 1 .. 10 loop begin -- dml , stored procs dml insert .. .; insert b .. .; insert .. .; delete .. .; update c .. .; m_package.some_proc_with_dml; exception when others merror := merror + || ', ' || + sqlerrm; miserror := true; end; end loop; commit; if miserror raise_application_error(-20000, merror); end if; end; thanks in advance. you can set savepoint , , rollback savepoint e.g.: declare ... begin in 1 .. 10 loop begin savepoint my_savepoint_name; -- dml , stored procs dml ...

How can I have about 1000 Android virtual devices to test "Push Notification"? -

i want have 1000 android virtual device test project, can create 2 android virtual device laptop. how can do? you cannot have such test environment yourself. afaik there existing company providing such service. please refer link http://www.perfectomobile.com/portal/cms/services/android following statement website: developing applications android? perfecto mobile's android cloud enables test mobile apps via web on dozens of real android-based devices, operating in live mobile networks in us, uk, canada, france , israel.

c# - Unable to add modal popup window in aspx -

Image
this current code gives output displayed below <div class="marketplacewidgethead">marketplace</div> <div id="divsupplier" runat="server"> //the details got .cs file </div> i want make such items present inside divsupplier gets displayed in popup when button pressed such 1 given below. ive tried using modalpopup window, ( http://pastebin.com/6sm384we followed example , got http://pastebin.com/srh2ytyz ) shows me errors such as unrecognized tag prefix or device filter ajaxcontroltoolkit. or can guide me on using fancybox ? download [fancybox][1]. you should use fancybox inline type. here how use. add div tag set runat server , display none. <div runat="server" id="divpopup" style="display:none"> </div> you can access divpopup code behind. set content of popup code behind. divpopup.innerhtml="items.... (with html)"; and add link show p...

cryptography - license keys generation method for software product -

we have software database product delivered customer. fees charged based on number of factors such as number of users can created number of database transactions etc we wanted give license key whenever user pays time duration. license key should contain such information duration of product, number of users/transactions allowed etc.. what cryptographically secure way of license key generation (that contains whole information , can read securely our system @ end) prevent user illegal usage. i know rsa method how go it? , there tools available should checkout? you can generate license files public-private key cryptography, , using rsa. please @ library, can found useful. http://afewguyscoding.com/page/2/ library people have done survey, give idea how method works. there github project using similar approach. visit https://github.com/starschema/slm4j

solr - Add shard replica in SolrCloud -

everytime start new node in solr cluster shard or shard replica assigned automatically. how specify shard/shards should replicated on new node ? i'm trying configuration 3 shards, 6 servers - 1 each shard master , 3 replicas - , shard1 have 3 replicas, 1 on each of servers while shard1 , shard2 one. how can achieved? you can go core admin @ solrcloud web gui, unload core has been automatically assigned node , create new core, specifying collection , shard want assigned at. after create core should see @ cloud view , node has been adeed specific shard , after time documents of shard have been sychronized node.

linux - What happens when a signal is received while already in a signal handler? -

i have parent process spanning several child processes. want know when child process exits registering sigchld signal handler. the question is, happens if sigchld (or other signal) received, while parent process in signal handler? i can think of following outcomes: the signal ignored the signal queued, , processed current handler returns the current handler in turn interrupted, main program which 1 correct? in concrete example (the same signal being received), signal delivered after signal handler has finished (so bullet point #2 correct). note, however, may "lose" signals. the reason while signal being inside handler, blocked. blocked signals set pending, not queued. term "pending" means operating system remembers there signal waiting delivered @ next opportunity, , "not queued" means setting flag somewhere, not keeping exact record of how many signals have arrived. thus, may receive 2 or 3 (or 10) more sigchld while in han...

python - csv.DictWriter delimiter set to space implies text in " " -

hi noticed while using dictwriter , delimiter=' ' instead of ',' string saved file in "" while use of comma without. how set things have strings without " " ? code import csv golds_two =[] mydict ={} open ('filea.csv','ru') csvfile: wszystkie=csv.dictreader(csvfile,delimiter=',') w in wszystkie: mydict[(w['url']).split('/')[-1]]=w['mediaobject id'] open ('fileb.csv','ru') csvfile: golds=csv.dictreader(csvfile,delimiter=';') g in golds: g['mediaobject id']=mydict[g['id']] golds_two.append(g) open('filec.csv','w') f: head_fields =golds_two[0].keys() head_fields.remove('id') print head_fields head_fields=sorted(head_fields,reverse=true) csvdw = csv.dictwriter(f,delimiter=" ",fieldnames=head_fields) headers = dict( (n,n) n in head...

Pulling links to all documents that have a column "XXXX" in sharepoint -

i have site collection in there lot of sites, , each site has number of documents tagged "xxx" in particular column. now, if have pull links documents in site collection tagged "xxx" , display them in list, how go it? mean how start it? do have knowledge javascript ? because use kind of task... for example spservices can sites: $().spservices({ operation: "getallsubwebcollection", completefunc: function(xdata, status) { $(xdata.responsexml).find("webs > web").each(function() { var $node = $(this); getdocuments( $node.attr("title") ); }); } }); then sharepointplus (because syntax easier can still use spservices) can documents: function getdocuments(site) { $sp().list("my document list", site).get({fields:"title",where:"my_x0020_column = 'xxx'"}, function(data) { (var i=data.length; i--;) console.log(data[i].getattribute("title")) }...

mysql - Cannot make a registration page on PHP using SHA512 encrypyion -

this question has answer here: how use bcrypt hashing passwords in php? 9 answers i have small problem here on register and/or login page. can register, cannot login using newly registered account. may please ask advice guys? execaddemp.php <?php include ("./db_connect.php"); include ("./functions.php"); if(isset($_post['email'], $_post['username'], $_post['status'])) { $username = $_post['username']; $firstname = $_post['firstname']; $lastname = $_post['lastname']; $mi = $_post['mi']; $email = $_post['email']; $status = $_post['status']; if($result = mysqli_query($mysqli, "select * employee email='$email'")){ $row_count = mysqli_num_rows($result); //now display errors print ("email in use!<br>"); } $password = $_post['passwor...

biginteger - What variable type can I use to hold huge numbers (30+ digits) in java? -

is there large variable type can use in java store huge numbers (up around forty digits)? long 's maximum value 9223372036854775807, 19 digits -- not large enough. i'm trying create calculator can handle large numbers, because nowadays can hold insufficient 10 digits or so, , want want accurate calculations numbers of larger magnitude edit thanks answers. can use biginteger big integers, limit being computer's memory (should sufficient). decimals, i'll use float ^e, @webdaldo suggested, or bigdecimal (similar biginteger), @kocko suggested. you can use biginteger class. biginteger bi1 = new biginteger("637824629384623845238423545642384"); biginteger bi2 = new biginteger("3039768898793547264523745379249934"); biginteger bigsum = bi1.add(bi2); biginteger bigproduct = bi1.multiply(bi2); system.out.println("sum : " + bigsum); system.out.println("product : " + bigproduct); output: sum : 36775935281...

Monitoring app launches on android -

i need create app able check when other apps opened or closed ("on resume" or "on pause") on device. need check time of use of each app. can without root access in device? try code activitymanager activitymanager = (activitymanager) this.getsystemservice( activity_service ); list<runningappprocessinfo> procinfos = actvitymanager.getrunningappprocesses(); for(int = 0; < procinfos.size(); i++){ if(procinfos.get(i).processname.equals("com.android.browser")) { toast.maketext(getapplicationcontext(), "browser running", toast.length_long).show(); } } find package name using download package name viewer https://play.google.com/store/apps/details?id=com.gijoon.pkgnameviewer&hl=en

java - What wrong here in addOrderBy() method of Jooq? -

i using jooq , using below code selectquery<record> selectquery = transaction.selectquery(); now jooq telling have method check here can pass collection , doing same, check below list<sortfield<t>> orderbyvalue1; and doing this selectquery.addorderby(orderbyvalue1); but in above line getting compile time exception the method addorderby(field<?>...) in type selectquery<record> not applicable arguments (list<sortfield<t>>) what doing wrong here? there's flaw in jooq api, described in issue #2719 . time being, type of orderbyvalue1 list must adapted: // correct type: list<sortfield<?>> orderbyvalue1; // wrong type list<sortfield<t>> orderbyvalue1; note above types not same. more info, consider reading oracle tutorial documentation on generics .

Media Query CSS important -

making responsive website, i wrote this, doesn't work. @media (max-width: 767px) { #nav { display:block; } } but, wrote this, works! @media (max-width: 767px) { #nav { display:block !important; } } why? :( check css code , higher specificity changing #nav element.

java - MultiThreading_problem with wait and notify -

i working on simpler version of following question: http://www.cs.ucf.edu/courses/cnt4714/spr2011/prog1.pdf and have simplified problem in following manner: so: input pipe pipe4 , output pipe pipe0 s1: input pipe pipe0 , output pipe pipe1 s2: input pipe pipe1 , output pipe pipe2 s3: input pipe pipe2 , output pipe pipe3 s4: input pipe pipe3 , output pipe pipe4 the output getting: who came?? pipe4 , pipe0:position0 granting access pipe4 , pipe0 came?? pipe0 , pipe1:position1 sleeping : 1 relieving notified final capacity @ 0 4 4,4,3,1,2 */ every time gets stuck @ point.. can me this.. any highly appreciated thank you i enclosing code too: package thread; import java.util.arraylist; class connection { string in_pipe; string out_pipe; //true: available && false: occupied static boolean available[]={true,true,true,true,true}; public connection(string in_pipe,string out_pipe) { this.in_pipe=in_pipe; this.out_pipe=out_pipe; } public void setavailabi...

jsf - Primefaces dialog only working once -

i got menu opening dialog (primefaces 3.5) <h:form> <p:graphicimage id="img" value="../resources/img/user.jpg" style="cursor:pointer" title="my profile" height="70px"/> <p:overlaypanel id="imgpanel" for="img" showeffect="blind" hideeffect="fade" showevent="mouseover" hideevent="fade"> <h:outputlink id="editlink" value="javascript:void(0)" onclick="profiledlg.show()" title="login">edit profile</h:outputlink><br /> <h:outputlink id="loginlink" value="javascript:void(0)" onclick="passwddlg.show()" title="login">change password</h:outputlink><br /> <p:commandlink action="#{authbackingbean.logout}" value="logout" ...

javascript - Charset of a textarea, keyword not recognized -

i have editor it's called editarea , should work editor programming languages embedded in web page; using editor other stuff. it's exp'lained in manual of editarea we've built new syntax file, contains special characters, cause syntax has recognize contains italian words. below snapshot of syntax file: ,'keywords' : { 'feelings' : [ "emozioni","gioia","felicit\xe0", etc. and these regular expressions: ,'regexps' : { 'lemmas' : { 'search' : "()(#[a-za-z0-9'èéòàìù]*)()" //'search' : "()(#[a-za-z0-9'èéòàìù\s]+#)()" ,'class' : 'lemmas' ,'modifiers' : 'g' ,'execute' : 'before' }, as can see letters accent expressed code in "keyword" , without code in "regular expression". problem words ends accent letter not "color...

c++ - Why is Multiple Inheritance in Classes avoided? -

is because confusing , fields intermixed or other reason? allowed c++ not in java?? for example: herbivore , carnivore derived animal , omnivore derived both herbivore , carnivore. won't fields mixed up. why multiple inheritance in classes avoided? because confusing , fields intermixed or other reason? multiple inheritance avoided because leads several problems can difficult fix novice programmer. possible problems: diamond inheritance. carelessly inheriting multiple interfaces (which weren't designed) can pollute object's "public" or "protected" section methods aren't useful particular object. you have aware of construction/destruction order when object inherits several other objects, otherwise might crashes due undefined behavior caused things double-delete. in other words, if object c inherits objects , b, , ~a somehow uses provided object b, ~a should called before ~b . i.e. in scenario class c: public b, public a{}:...

syntax - VHDL prog to implement 8to1 mux using 4to1 (structural modelling) -

i student , have started learning vhdl. need point me in right direction. have done far: library ieee; use ieee.std_logic_1164.all; entity mux81 port( : in std_logic_vector(7 downto 0); s : in std_logic_vector(2 downto 0); z : out std_logic); end mux81; architecture struc of mux81 signal z1,z2:std_logic; component mux41 port(a,b,c,d,s0,s1:in std_logic;q:out std_logic); end component; component mux21 port(m,n,s2:in std_logic;o:out std_logic); end component; m1,m2:mux41 use entity work.mux41(struc1); m3:mux21 use entity work.mux21(arc); signal z1,z2: std_logic; begin m1 : mux41 port map(a(0),a(1),a(2),a(3),s(0),s(1),z1); m2 : mux41 port map(a(4),a(5),a(6),a(7),s(0),s(1),z2); m3 : mux21 port map(z1,z2,s(2),o); end struc; library ieee; use ieee.std_logic_1164.all; entity mux41 port( : in std_logic_vector(3 downto 0); s : in std_logic_vector(1 downto 0); z : out std_logic); end mux41; architecture struc1 of mux41 component and3 (a,b,c : in std_logic;d : out std_logic); end com...

vb.net - creating multiple datatables in for each loop -

i have following sub. have string array e.g. 3 strings (a,b,c). wanna fill datatables data excelsheets , name tables a,b,c. sub create_dataset(byval paramarray datatablenames() string) each fileelement in datatablenames ... myconnection.open() da.fill(ds, fileelement) myconnection.close() dim dt datatable = ds.tables(fileelement) form1.datagridview1.datasource = ds.tables(0) form1.datagridview2.datasource = ds.tables(1) running code give me error "ds.tables(1) doesnt exist. according understanding because create 1 table (dim dt datatable = ds.tables(fileelement))and put data table on , on again. how can create table each array element? you need explicitly add new datatable dataset's tables collection: sub create_dataset(byval paramarray datatablenames() string) dim dt datatable myconnection.open() each fileelement in datatablenames ... dt = new datatable(fileelement) da.fill(dt) ds.tables.add(dt) next myconnection.clo...

php - preg_replace to delete something in a special string -

hi tried delete in string. don't know ho make it. my string: @trash='test1',value1='test2',@trash='test3',value2='test4' i want delete @trash example = @trash='test1', . perhaps important is, of course value in example above "test1" allways changing. try following codes echo preg_replace("/@trash='(.*?)',/", "", $string); output value1='test2',value2='test4'

is usage from multifiltering with jQuery useful? -

i got code $('.pbwarn div').filter(function(index){ return parseint(this.innerhtml) > 60; }).addclass("pb_yellow"); $('.pbwarn div').filter(function(index){ return parseint(this.innerhtml) > 80; }).addclass("pb_red"); and want know if useful? or maybe way realize this. i want change green bar yellow when percentage larger 60 ( id="max60" ) , change red if percentage larger 80 ( id="max80" ) just want script running perfect. asking if there potential improvement :d you can check demo better understanding i'd suggest: $('.pbwarn div').addclass(function(){ var num = parseint((this.textcontent || this.innertext),10); if (num > 80) { return 'pb_red'; } else if (num > 60) { return 'pb_yellow'; } }); js fiddle demo . the anonymous function within addclass() iterate on elements returned selector, and, in each itera...

ios - Crash in a CAKeyframeAnimation for animating a view along a path -

i have code animate uiview: zoom down while animating along path. it crashes error below (reproducible: always): coregraphics`cg::path::apply(void*, void (*)(void*, cgpathelementtype, cgpoint const*)) const: 0x1055c06: pushl %ebp 0x1055c07: movl %esp, %ebp 0x1055c09: subl $24, %esp 0x1055c0c: movl 8(%ebp), %eax 0x1055c0f: movl (%eax), %ecx 0x1055c11: movl (%ecx), %eax 0x1055c13: movl 16(%ebp), %edx 0x1055c16: movl %edx, 8(%esp) 0x1055c1a: movl 12(%ebp), %edx 0x1055c1d: movl %edx, 4(%esp) 0x1055c21: movl %ecx, (%esp) 0x1055c24: calll *64(%eax) 0x1055c27: addl $24, %esp 0x1055c2a: popl %ebp 0x1055c2b: ret i think comes method below ( pathanimationwithstartpoint: ), if don't add cakeyframeanimation returned it, i.e., just: [group setanimations:@[ zoomanimation ]]; instead of [group setanimations:@[ zoomanimation, pathanimation ]]; it runs without crashing. - (cakeyframeanimation *) pathanimationwithstartpoint:(cgpoint...

asp.net mvc 3 - DisplayFor is not keeping data in ViewModel on PostBack -

this question has been asked before other, still don't it. using mvc3 razor , have screen entering trouble tickets. once data (a textarea note) entered, controller redirects same screen. of data display only. if use displayfor or displaytextfor, data not being posted back. have used hiddenfor. works. however, keep hearing others hiddenfor not ideal. don't want editorfor because, want disable field. (i follow working says hiddenfor wrong, won't why. :< lol) razor @html.displaytextfor(m => m.ticket.name) viewmodel public class ticketdetailsviewmodel { [displayname("customer name")] public string name { get; set; } control [httppost] public actionresult detail(ticketdetailsviewmodel viewmodel) return redirecttoaction("detail"); only values part of input or other form control posted client. displayfor meant model display data, nothing else. you have 2 options; use hidden fi...

html - Generating grid lines with CSS gradients -

i'm trying generate grid alternating solid , dotted lines on tall column. catch solid lines need programmatically farther apart, , in doing so, should reveal more dotted lines. here code have far: jsfiddle: http://jsfiddle.net/etzvj/ css: .test { width: 100%; height: 2000px; background: linear-gradient(white 24px, transparent 24px) 0px -24px, linear-gradient(black 24px, transparent 24px), linear-gradient(90deg, white 1px, red 1px, red 2px, white 2px); background-size: 1px 25px, 1px 50px, 3px 1px; } html: <div class="test"> &nbsp; </div> i think i'm pretty close. can adjust second background-size(1px 50px) 1px 75px push black lines apart , show 2 dotted lines. there 2 things code aren't quite right, though. first, line height 31px, surprising because think specified 25px tall gradients. i'm sure make these numbers smaller lines 25px apart, i'd know why it's taller expected. sec...

phpmyadmin - #1130 - Host 'localhost' is not allowed to connect to this MySQL server - After running an Acunetix scan -

i know type of question has been asked lots of times, none answer problem. please read carefully. i running website on localhost using wamp server normally. when today decided run acunetix scan vulnerabilities on localhost server. acunetix sent tons of commands mysql table in short period of time ( since it's localhost commands went fast ) cause mysql server crash error: #1130 - host 'localhost' not allowed connect mysql server what i've tried: running mysql through mysqld --skip-grant-tables had access mysql while on that, tried running drop user 'root'@'127.0.0.1'; grant privileges on . 'root'@'%'; but got error: mysql> drop user 'root'@'127.0.0.1'; grant privileges on . 'root'@'%'; error 1290 (hy000): mysql server running --skip-grant-tables opt ion cannot execute statement error 1064 (42000): have error in sql syntax; check manual corresponds mysql server version right syntax u...

php - Modify an array -

i've got array generated mysql query database it's : array ( [0] => array ( [0] => array ( [id_device] => 1 [device_name] => iphone 5 [device_brand] => apple ) [1] => array ( [id_device] => 2 [device_name] => iphone 4/4s [device_brand] => apple ) ) [1] => array ( [0] => array ( [id_device] => 3 [device_name] => galaxy s4 [device_brand] => samsung ) [1] => array ( [id_device] => 4 [device_name] => galaxy s3 [device_brand] => samsung ) ) ) i'd like : array ( ...