Posts

Showing posts from August, 2013

html - jquery not in a child div (can I use find?) -

i trying select whole div not specific div inside main div. example follows: <div id="main_holder"> <div id="secondholder"> <div id="thirdholder"> <div id="dividonotwanttouse" class="notused"></div> </div> </div> </div> i trying simple click see when click on div, shouldn't alert. $('#main_holder').not('#main_holder.notused').click( function(event) { alert( 'pullmenu clicked' ); }); it's not working, best approach? there way use find in not selector? example works: $('#main_holder').find('#dividonotwanttouse').css({ border: '5px solid red' }); solution arun: $('#main_holder').click( function(event) { if(!$(event.target).closest('.notused').length) { alert( 'pullmenu clicked' ); } }); try $('#main_holder').click( function(e

javascript - Dynamically generated field in nested form added twice Rails -

i have 2 models, first grants second specs. specs has 2 fields ineligibility , eligibility , nested grants. have set fine need modifying jquery because every time click "add ineligibility", eligibility added. doesn't show on form show blank bullet on show view. when go edit form see blank field eligibility. if enter new text eligibility both fields save correct text. want able add 1 field without automatically adding other. jquery , helper code comes railscasts pro #196 nested model form. i'm new rails , jquery appreciated! jquery -> $('form').on 'click', '.add_fields', (event) -> time = new date().gettime() regexp = new regexp($(this).data('id'), 'g') $(this).before($(this).data('fields').replace(regexp, time)) event.preventdefault() and helper method: module applicationhelper def link_to_add_fields(name, f, association) new_object = f.object.send(association).klass.new

Android Vertical tabhost -

Image
i want built vertical tab host below image i tried following code tabs not visible gettabwidget().setorientation(linearlayout.vertical); is possible implement tab host below.if possible tell me way implement tab host below.and post links if there built in project's implement below image. (or) possible add activity image view click similar tab bar click below mtabhost.addtab(mtabhost.newtabspec("tab_test1").setindicator("tab 1").setcontent(r.id.textview1)); because if possible put image views , change activities on each item click help me out in making vertical tab-host. you need place tab widget in horizontal linearlayout in xml file: <tabhost android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@+id/imageview3" > <linearlayout android:layout_width="fill_parent" a

java - Displaying images in jsf -

im having strange problem of displaying image in jsf. have images on server in folder: /glassfishv3/glassfish/domains/domain1/applications/images . i have full access folder, can upload , delete images through bean , works fine when try display images, nothing shows! have tried following: <h:graphicimage value="/images/image.jpg"/> <h:graphicimage value="/glassfishv3/glassfish/domains/domain1/applications/images/image.jpg"/> <img src="/glassfishv3/glassfish/domains/domain1/applications/images/image.jpg"> but nothing seems work. not sure im doing wrong here welcome. big thx in advance looks images being hosted separately, <h:graphicimage url="<urlpath>/images/image.jpg" width="200" height="171" /> e.g. <h:graphicimage url="http://localhost:8080/images/image.jpg" width="200" height="171" />

c# - How to play (13 kb/s) .wav file in asp.net -

i couldn't play (.wav - 13 bit) file in aspx page.i've tried html5 player , embedding mediaplayer in html , soundplayer in asp.net. dont want convert wav file. there solution play ? thanks... background: <embed src="bgsound.wav" hidden="true" autostart="true" loop="1"> on click: <a href="success.wav">play sound</a> http://www.phon.ucl.ac.uk/home/mark/audio/play.htm have try this? source: best way play wav files in browser?

Adding div element to body or document in JavaScript -

i creating light box in pure javascript. making overlay. want add overlay body want keep content on page. current code adds overlay div removes current contents in body. how add div element , keep contents on body? var el = document.getelementbyid('element'); var body = document.getelementsbytagname('body'); el.innerhtml = '<p><a id="clickme" href="#">click me</a></p>'; document.getelementbyid('clickme').onclick = function (e) { e.preventdefault(); document.body.innerhtml = '<div style="position:absolute;width:100%;height:100%;opacity:0.3;z-index:100;background:#000;"></div>'; } try out:- http://jsfiddle.net/adiioo7/vmfba/ use document.body.innerhtml += '<div style="position:absolute;width:100%;height:100%;opacity:0.3;z-index:100;background:#000;"></div>'; instead of document.body.innerhtml = '<div style="po

vba - how to select rows with duplicate content with criteria in excel? -

as can see in data table, id not unique, select unique id , value latest date. results looks results table. can provide vba codes in excel with? appreciated. data table id dates value 10021 1/1/2012 591.00 10021 1/1/2014 591.00 10021 8/1/2015 621.00 10060 1/1/2006 240.00 10060 1/1/2011 385.00 10060 1/1/2014 446.00 10060 8/1/2015 468.00 10061 1/1/2006 501.00 10061 1/1/2011 658.00 10061 1/1/2014 796.00 10061 8/1/2015 836.00 results table id dates value 10021 8/1/2015 621.00 10060 1/1/2014 468.00 10061 8/1/2015 836.00 i sorted dates, newest oldest, used remove duplicates command. think automatically keep first one, newest one

java - ArrayList<String> delete query -

here's output: -----query----- [1]update [2]delete [3]search [4]show choose query:1 enter student id:1 enter first name: respo enter middle name: topher enter last name: raspo want query?(yes/no) yes -----query----- [1]update [2]delete [3]search [4]show choose query: 4 12 christopher reposo porras 1 respo topher raspo as can see in picture i'm trying make simple little system without database using arraylist contain data problem in delete query. in delete query tell user type student number 1 delete information of , contain first name, middle name, last name don't have logic in arraylist such thing. way possible use 1 arraylist in case or need make many array list solve problem. public static void main(string[] args) { //initialize scanner input process scanner scan = new scanner(system.in); //initialize needs variable list<string> list = new arraylist<string>(); int choose,choosequery; string chooseyesorno = " ";

Maximum stack size needed for a C program on MSP430 -

in c program doesn't use recursion, should possible in theory work out maximum/worst case stack size needed call given function, , calls. there free, open source tools can this, either source code or compiled elf files? alternatively, there way extract function's stack frame size elf file, can try work out manually? i'm compiling msp430 using mspgcc 3.2.3 (i know it's old version, have use in case). stack space allocate set in source code, , should small possible rest of memory can used other things. have read need take account of stack space used interrupts, system i'm using takes account of - i'm trying work out how space add on top of that. also, i've read function pointers make difficult. in few places function pointers used here, know functions can call, take account of these cases manually if stack space needed called functions , calling functions known. static analysis seems more robust option stack painting @ runtime, working out @ runtime

c# XML Schema validation -

i have nice xml file this: <?xml version="1.0" encoding="utf-8" ?> <assets path="c:\users\r3plica\google drive"> <assetd> <filename>boomerang - error codes.xlsx</filename> <displayname>boomerang - error codes</displayname> <description>this boomerang error codes file</description> <tags> <tag>excel</tag> <tag>boomerang</tag> </tags> <categories> <category>1</category> <category>4</category> </categories> </assetd> <asset> <filename>issue tracker v5.xlsx</filename> <description>this issue tracker skipstone</description> <tags> <tag>excel</tag>

jquery - Disable Button if data-quantity is less than 1 -

i want disable following button if "data-quantity" attribute less 1. can't figure out how form if statement this. <button type="submit" data-product_id="1" data-product_sku="test" data-quantity="0" class="add_to_cart_button button product_type_simple">add cart</button> i've tried this: var cart_button = $('.add_to_cart_button'); if(cart_button.attr("data-quantity") < 1) { cart_button.prop("disabled", true); } jquery has built-in ability read (and set if need be) data tags. use .data() syntax . note, drop "data-" prefix when using property. also, sure wrapping in document.ready function. $(function(){ var cart_button = $('.add_to_cart_button'); if(cart_button.data("quantity") < 1) { cart_button.prop("disabled", true); } });

achartengine onclick seriesselection get wrong value after repaint -

i new achartenging, , using achartengine draw pie chart. there onclick listener listening click on chartview, series index , value correct when first initialized. but, after the data updated , chartview repainted , returns wrong index , value. , seems cached, because found returned index , value before repainting. i tried mchartview.setdrawingcacheenabled(false); wont work. knows why? thanks in advance i tried recreate chartview rather call repaint, , works. but, think that's not best way problem, maybe bug in achartengine v1.1.0

Can someone clarify this graph presentation for me? -

i have presentation of solid, cycle free graph forms follows: remove vertices has degree of 1 (has 1 edge) 1 one if there more 1 opinion, vertex lowest value removed when vertex removed, vertex next me marked this go on until graph has 1 vertex left here's example: 2 3 3 \ / / 5 1 => 5 1 => 5 1 => 5 => 5 \ / \ / \ / \ 4 4 4 4 the presentation is: 1 1 4 5 how can turn presentation f.e. following matrix: 1 2 3 4 5 ----------------- 1 0 1 1 1 0 ----------------- 2 1 0 0 0 0 ----------------- 3 1 0 0 0 0 ----------------- 4 1 0 0 0 1 ----------------- 5 0 0 0 1 0 ----------------- i've been struggling while now, if can help, appreciate it! it seems matrix: 1 2 3 4 5 ----------------- 1 0 1 1 1 0 ----------------- 2 1 0 0 0 0 ----------------- 3 1 0 0 0 0 -

xml parsing - Extracting specific internal nodes from an xml file and construct a dataframe in r -

i have xml file want extract specific nodes in r using xmltodataframe xml package. can function extract data individual nodes. ex: xml <- xmlparse("file.xml") df <- xmltodataframe(getnodeset(xml, "//lat")) however wondering if possible extract multiple nodes @ same time? looking make 5 column dataframe extracting data nodes: //nucleotides , //lat , //lon , //bin_uri , //record_id xml. the structure of xml file follows (just 1 record_id there many in file need extract): <record> <record_id>634750</record_id> <processid>ccsma054-07</processid> <bin_uri>aag2098</bin_uri> <collection_event> <collectors>arctic ecology</collectors> <coordinates> <lat>58.805</lat> <lon>-94.214</lon> </coordinates> <country>canada</country> <province>manitoba<

c# - How 2 WebAPI Routing can accept same type parameter -

i have web api has several methods. have problem routing. have 1 method returning products yearid , method returning product product id . here 2 routes came with: /api/records/products?yearid=10 /api/records/products/15 these 2 methods: [httpget] [route("getbyyearid")] public async task<product> getbyyearid(int yearid) { ..... } [httpget] [route("getbyid")] public async task<ienumerable<product>> getbyid(int productid) { ...... } what route mapping should have can access web api these 2 routes: /api/records/products?yearid=10 /api/records/products/15 you using attribute routing customize how want routes used. here example of how can achieve routes wanted: [routeprefix("api/records")] public class recordscontroller: apicontroller { // api/records/products?yearid=10 [httpget] [route("products")] publ

c++ - "ambiguating new declaration" error for a templated method in a templated class -

i have written following earth-shattering application: class somea { }; class someb { }; class somec { }; template <typename a, typename b, typename... cs> class foo { public: template <typename u> static void bar(); }; template <typename u> void foo<somea, someb, somec>::bar() { }; int main() { return 0; } when compile (gcc 4.9.3 -std=c++11 ), following error: a.cpp:10:36: error: ambiguating new declaration of ‘static void foo<somea, someb, somec>::bar()’ void foo<somea, someb, somec>::bar() { }; ^ a.cpp:6:36: note: old declaration ‘static void foo<a, b, cs>::bar() [with u = u; = somea; b = someb; cs = {somec}]’ template <typename u> static void bar(); ^ why "ambiguating declaration", , how else can implement bar u s specific instantiation of foo ? with clang 3.6.2, error: a.cpp:9:1: error: template parameter list matching non-temp

java - Getting Error in Overloading a program -

help me in solving overloading program public class overloading { void add() { system.out.println("default"); } void add(int a) { system.out.println("one int parameter passed"+a); } void add(int a,int b) { system.out.println("two int parameter passed"+a+" "+b); } void add(int a,int b,int c) { system.out.println("three int parameter passed"+a+" "+b+" "+c); } void add(char x) { system.out.println("one char parameter passed"+x); } void add(char x,char y) { system.out.println("two char parameter passed"+x+" "+y); } void add(char x,char y,char z) { system.out.println("three int parameter passed"+x+" "+y+" "+z); } public static void main(string []args) { overloading d=new overloading(); d.add(z); } } when use d.add(1) or other works using d.add("p") not work me guys .... , thanx in advance by

javascript - How to get prettyprint to work on dynamically generated dom element -

i'm using prettyprint plugin syntax highlighter, work fine when page loads when add new elements dynamically doesn't work! tried using prettyprint() invoke after loading new contents didn't work! followed instructions on plugin website wrapping prettyprint() function didn't work neither! appreciated. installed plugin this: <script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script> my code is: function showcode(e){ (e.preventdefault) ? e.preventdefault() : e.returnvalue = false; var parent = document.createelement('div'), pre = document.createelement('pre'), code = document.createelement('code'), elm = (e.currenttarget) ? e.currenttarget : e.srcelement, src = elm.getattribute('href'), id = elm.getelementsbytagname('img')[0].getattribute('src').replace(/images\/(.+?)\.png/g, "$1"); parent.id =

php - Share on Facebook not accurate -

i having problem on sharing page on facebook go directly problem need asap. should url www.filipinogourmetchef.com/uploads/restaurant/serialkey happens in url became http%3a%2f%2fwww.filipinogourmetchef.com%2fuploads%2frestaurant%2fl6rdqft2vtdnjmstap2.jpg think reason why page picture not accurate url. how share website page <a class="btn" target="_blank" href="http://www.facebook.com/sharer.php?s=100&amp;p[title]=<?php echo urlencode("fgc resto");?>&amp;p[summary]=<?php echo urlencode("yes") ?>&amp;p[url]=<?php echo urlencode(base_url().'restaurants/view_restaurant/'.$r_sk); ?>&amp;p[images][0]=<?php echo urlencode(base_url().'uploads/restaurant/'.$restopic); ?>">share on facebook</a>

java - Selenium WebDriver - how to get elements of tables and iterate through rows -

i want iterate tables per row, in test scenario data each rows. done using absolute xpath. there better/alternative way other using absolute xpath iterating through these rows? this logic of code before: private static int irow; webelement sworkunitrows = null; for (irow = 1; irow <= 10; irow++) { sworkunitquery = driver.findelement(by.xpath("html/body/div[2]/div[4]/div/div/div[3]/div[1]/table/tbody/tr["+ irow + "]/td[5]/div")); // actions here, click , verify data each rows until finds specific data break; } any ideas this? highly appreciate inputs thanks! you can use findelements(...) instead of findelement(...) . here example: list<webelement> elements = driver.findelements(by.xpath(".//*/tr/td[5]/div")); for(webelement element:elements){ ... } this return list of div s located in 5th column of each row.

ruby - Get all possible permutations of bigger array -

i trying take array of strings ["-", "+", "*"] , figure out combinations of them given size. possible doing following: arr = ["-", "+", "*"] perms = arr.permutation(2).to_a # => [["-", "+"], ["-", "*"], ["+", "-"], ["+", "*"], ["*", "-"], ["*", "+"]] however, want results array bigger given array. e.g., arr.permutations(4).to_arr . possible? yes, it's possible. perms = arr.repeated_permutation(4).to_a

javascript - Error management in grails -

i quite new grails , in application need check dates. in former java program have used 2 javascript functions different detail granularity. both accept dates 1970-01-01 2099-12-31. 1 demands correct date , (optionally) time , tells user he/she made erroneous entry: function okdate1(dtstr) { var ok = true; // first trim off leading , trailing white space var trimpattern = /(?:\b(.*)\b)/; dtstr = (dtstr.match(trimpattern))[1]; // verify input within range , correct var pat = /^((?:19[7-9][0-9])|(?:20[0-9][0-9]))-((?:(?:0)?[1-9])|(?:1[0-2]))-((?:(?:0)?[1-9])|(?:[1-2][0-9])|(?:3[01]))(?: ((?:(?:0|1)[0-9])|(?:2[0-3])):([0-5][0-9]))?$/; var dtm = dtstr.match(pat); if (!dtm) { ok = false; } else { // verify day in in range given month var days = array(31,28,31,30,31,30,31,31,30,31,30,31); // compensate leap year if ((((dtm[1] % 4) === 0) && !((dtm[1] % 100) === 0)) || ((dtm[1] % 400) === 0)) { days[1] = 29; } if (dtm[3] > days

C - Segmentation Fault Somewhere -

i keep getting segmentation fault. figured out happens between these 2 lines: printf("%s - file exists!\n", file_name); printf("inforloop"); but i'm unsure why segmentation fault keeps occuring. entire code: #include<stdio.h> #include<unistd.h> #include<string.h> file *fp; char err_message[128], file_name[128]; int main(int argc, char *argv[]) { if(argc <= 2) { printf("error : usage %s <file name>\n", argv[0]); return 1; } int = 1; for(i; i< argc; i++) { strcpy(file_name, argv[i]); if ((access(file_name, f_ok)) != -1) { printf("begining of loop\n"); printf("%s - file exists!\n", file_name); printf("inforloop"); fclose(fp); } else { sprintf(err_message, "open %s", file_name); perror(err_message)

java - very simple copying a file from my jar -

ok, wanted open pdf file put in jar, needed copy file jar disk, , did following code: inputstream = jar.class.getresourceasstream("images/lol.pdf"); outputstream os = new fileoutputstream("753951741.pdf"); byte[] buffer = new byte[4096]; int length; while ((length = is.read(buffer)) > 0) os.write(buffer, 0, length); os.close(); is.close(); my question is:how control file created? when execute program it's created under c:/users/buba in advance :) you can this: file file = new file("c:/753951741.pdf"); outputstream os = new fileoutputstream(file); in case file created in c:/ for more information file in java: http://docs.oracle.com/javase/6/docs/api/java/io/file.html#file(java.lang.string)

C# foreach string in array process in groups of X amout -

this question has answer here: how loop through ienumerable in batches 7 answers i trying iterate through array , process every x amount (in case 90), move go though loop until array has been exhausted. achieved if array fixed amount, sadly not. //test range of 90 total tag collection private void testexcelrange(string[] tagcollection) { string delltag = null; int maxgroupammount = 90; foreach(string singletag in tagcollection) { //process in groups of 90 -- maxgroupammount if (singletag != "none") { delltag += singletag+ "|"; } //after 90 process again until tagcollection complete } } here method splits list or array chunks of

I created an interview with python, but -

i got coding. 1 of projects create smalltalk interview myself. went until : if (sport == answer or sport == answer3 or sport == answer5): #yes if (vidgames == answer or vidgames == answer3 or vidgames == answer5): #yes print("so, " + name + ", i've learned, eat " + favfood + ", favorite color " + color + ", favorite sport(s) are/is " + favsport + ", , favorite video game(s) are/is " + favgame + ". interesting!") print() elif (sport == answer2 or sport == answer4 or sport == answer6): #no if (vidgames == answer2 or vidgames == answer4 or vidgames == answer6): #no print("so, " + name + ", i've learned, eat " + favfood + ", favorite color " + color + ", , don't play sports or video games. interesting!") print() elif (sport == answer or sport == answer3 or sport == answer5): #yes if (vidgames == answer2 or vidgames == answer4 or v

python - How to filter in `sqlalchemy` by string length? -

how filter in sqlalchemy string length? this code snippet: sess.query(db.articlestable).filter(or_( and_(db.articlestable.shorttext.length > 0), ... gave me following error: file "./aggregate_news.py", line 69, in is_acceptable db.articlestable.shorttext.length > 0), file ".../sqlalchemy/orm/attributes.py", line 211, in __getattr__ key) attributeerror: neither 'instrumentedattribute' object nor 'comparator' object associated articlestable.shorttext has attribute 'length' where articlestable is: class articlestable(base): __tablename__ = table_articles id = column(integer, primary_key=true) shorttext = column(string) ... you need use func sql function generator create length() function: from sqlalchemy.sql.expression import func sess.query(db.articlestable).filter(or_( and_(func.length(db.articlestable.shorttext) > 0),

reactjs - React-dom.js import statement results in Uncaught ReferenceError: define is not defined. -

i writing test component integration project using typescript , react in visual studio. use tracking down why following code has issue: define(["require", "exports", 'react', 'react-dom'], function (require, exports, react, reactdo m) on scripts/typings/react-dom/react-dom.d.ts reference path line, error flagged stating: "uncaught referenceerror: define not defined" line error reported on line 8, col 1 of javascript version shown below: the typescript component looks this: ///<reference path='../../scripts/typings/react/react.d.ts' /> ///<reference path='../../scripts/typings/react-dom/react-dom.d.ts' /> import react = require('react'); import reactdom = require('react-dom'); interface p { name?: string; } interface s { complete?: boolean; } class goal extends react.component<p, s> { state: s = { complete: false } private _togglecompletion = () => { this.setsta

r - How to control transparency (alpha) in ggplot violin plot's (dots) -

Image
the following image is created following code: library(ggplot2) library(plyr) library(reshape) df<- structure(list(variable = structure(c(1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l), .label = "bcd.id.ln", class = "factor"), value = c(1.133, 1.068, 1.01, 0.943, 1.048, 1.053, 0.999, 1.014, 1.149, 1.068, 0.898, 1.008, 0.976, 1.029, 0.95, 0.986, 1.102, 1.007, 1.08, 1.219), fc_log = c(0.180147861158429, 0.094911647025467, 0.0143552929770701, -0.0846703239869906, 0.0676387168753633, 0.0745054363636298, -0.00144341686966872, 0.0200576523412535, 0.200378797984026, 0.094911647025467, -0.15521264992094, 0.0114956388378294, -0.0350469470992008, 0.0412429822318813, -0.0740005814437769, -0.0203404482841755, 0.140124223909071, 0.0100636833446975, 0.111031312388744, 0.285698125958125), len = c(26654l, 26654l, 26654l, 26654l, 26654l, 26654l, 26654l, 26654l, 26654l, 26654l, 26654l, 26654l,

c - Confusion about array declaration -

what mean in c: char strings[ushrt_max][50]; is creating jagged array of characters called strings? no, above not create jagged array of strings. creates array of characters 2 dimensions, capable of storing ushrt_max c strings of 49 characters in length (the fiftieth char used '\0' terminator). a jagged array declaration this: char *strings[ushrt_max]; with array of pointers need allocate memory individual strings, strings differ in length 1 element other. array, on other hand, has memory allocated, places limit on length of strings, , has potential of using more memory need store shorter strings.

ios - Swift Error: Editor placeholder in source file -

hello implementing graph data structure. when try build application error "editor placeholder in source file" the full graph implementation pulled waynebishop's github here https://github.com/waynewbishop/swiftstructures class path { var total: int! var destination: node var previous: path! init(){ //error happens on next line destination = node(key: string?, neighbors: [edge!], visited: bool, lat: double, long: double) } } i changed node class around to: public class node{ var key: string? var neighbors: [edge!] var visited: bool = false var lat: double var long: double init(key: string?, neighbors: [edge!], visited: bool, lat: double, long: double) { self.neighbors = [edge!]() } } this error happens 5 times throughout code have built far. question has been asked, not answered. i think error may due changes init() in node class. prior changes init() . if is, how can add objects class? pardon me if not correct in programming t

How to make a listview to look like lined paper in android? -

i total noob in android app development, here want i have listview, populating list view custom adapter i want make listview lined paper though list empty (please see image <-- want make listview this) i want list view scroll-able, horizontal lines should scroll listview edit: figure1 <-- have achieved far (using nine-patch image) my listview code <listview android:id="@+id/listview1" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:background="@drawable/list_bg1" android:cachecolorhint="#000000"> </listview> i see 1 important distinction regarding request vs. image linked to: list displayed not empty. point out because request achieved assigning background drawable 9-patch image list row, filling display "blank paper" goin

c++ - What does this cast from long in a union to char* and back do? -

i examining code of simple executable packer writes section executable unpacks during startup, when stumbled upon piece of code: void setdistance( unsigned long size ) { char* set = (((char *)i)+punpacker->virtualaddress); union { short sh[2]; long l; } conv; conv.l = size; conv.sh[0] = 0; unpacker_set(set, (char *)(&conv.l), 4, text_distance); } size distance unpacker code in memory beginning of section supposed unpacked. in loader code defined unsigned long. unpacker_set on other hand has code: void inline unpacker_set( char* at, char* what, size_t size, unsigned long sig ) { dword oldprotect; unsigned char *set = (unsigned char *)at; while(*((unsigned long*)(set)) != sig) set++; if(virtualprotect(set, size, page_readwrite, &oldprotect) == true) for(unsigned i=0; i<size; i++) *(set+i) = *(what+i); } although understand second routine replaces value unpacker cod

php - Filtering through json array -

Image
i have json array http://paste.ofcode.org/wxs7ra35zjzk9wtuh7t3eh it represents trade offer steam. every offer has "items_to_give" , "items_to_receive". i want json array this { "items_to_give": [ { "market_hash_name": "awp | asiimov (field-tested)", }, { "market_hash_name": "m4a4 | asiimov (field-tested)" } ] , "items_to_receive": [ { "market_hash_name": "★ falchion knife | blue steel (field-tested)" } ] } every item has unique "classid" , "instanceid" "market_hash_name" shown in "descriptions" part of array. first have find name using "classid" , "instanceid" , move "items_to_give&

C++: Giving unknown class variable to template -

i've got class abc , want give unknown class variable template, that: template < v > class abc { // }; of course above code doesn't work (there wasn't type of parameter v ). have got ideas fix that? don't want give type of variable v template. there 2 functions, types different. how use both functions in class template below? #include <iostream> using namespace std; // types of functions max1 , min1 different! int max1(int a, int b){ return a>b?a:b; } int& min1(int a, int b){ return a<b?a:b; } template<typename _t, _t(function)(_t,_t)> class abc { public: _t a, b; _t get() { return function(a, b); } }; abc <int, max1> abc; // <- if write "abc <int, min1> abc;", error comes! how fix this? int main() { abc.a = 3; abc.b = 8; cout << abc.get() << '\n'; cin.get(); return 0; }

How to pass multiple objects using RedirectToAction() in Asp.NET MVC? -

i pass multiple objects using redirecttoaction() method. below actionresult i'm redirecting to. public actionresult getemployees(models.department department, models.category category, models.role role) { return view(); } i'd below public actionresult test() { models.department dep = new models.department(); models.category cat.......etc return redirecttoaction("getemployees", dep, cat, role); } any appreciated - thanks updated can use models.department dep = new models.department() { depid = employee.departmentid }; models.category cat = new models.category() { catid = employee.jobcategoryid }; models.role title = new models.role() { roleid = employee.jobtitleid }; return redirecttoaction("getemployees", new { department = dep, category = cat, role = title }); you cannot pass objects redirecttoaction method. method designed pass parameters. need pass values want em

.net - Parsing XML with c++ code -

im .net developer , have modify simple c++ code. the code fragment this: rval = cmgetreportelement("../statuscode",buffer,1024); if(rval==0) { dvaresponse->statuscode = gcnew string(buffer); int32::tryparse(dvaresponse->statuscode,functionreturnval); } return functionreturnval; it parsing xml statuscode (see below) , think failing (i cant debug it) <?xml version="1.0" encoding="utf-16"?> <transmissionresponse xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <statuscode>3002</statuscode> </transmissionresponse> can give me fail safe way status code out of xml i not know c++ @ please no pseudocode the cpp equivalent of : regex regex = new regex("<tag1>(.*)</tag1>"); var v = regex.match("morenonxmldata<tag1>0002</tag1>morenonxmldata"); string s = v.groups[

c# - the type or namespace name 'linq' could not be found in 'system' -

i'm trying understand process of bulding c# project using microsoft build engine (also known msbuild) , face problem. problem simple, think don`t understand something. i wrote simple program consist 2 .cs files. first file "mathop.cs". in file define 2 functions: add(double num1, double num2) , multiply(doble, double); second file "program.cs." here define 2 variable passed add function placed in mathop file , getting rezult; programm correct. then wrote simple msbuild file define tasks , targets building. , when launch in visual studio command prompt getting erorr cs0234: type or namespace name linq not found in system namespace. interesting referenced system.dll , etc. in msbuild file. , if comment using directives in program.cs file error disappear. <project defaulttargets="compile" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" > <propertygroup> <assemblyinfo>build</assemblyinfo> &l

ajax - how to add custom field option in php form for dynamic value storage -

how make php form in user allowed add custom field while filling form , data updates in database dynamically.. i searched lot on it, unfortunately unable use. thoight can achieved using zend or yii unable sort out. use in view: <script language="javascript"> function addinput() { document.getelementbyid('text').innerhtml += "field: <input name='alldata[]' type='text' value='' /><br />"; } </script> </head> <body> <form name="form"> <input type="button" onclick="addinput()" name="add" value="add input field" /> </form> <div id="text"> </div> and can fields in controller this: <?php foreach($_post['alldata'] $row){ echo $row; echo '<br />'; }?> as passing array of input type=text name 'alldata'.

content management system - AEM: locating selection in the drop down using keyboard keys -

i have created dropdown in component has list of items in alphabetical order. want selected or highlighted such can approximately location of item if type first letter of it. how can in aem6 ? can in jquery ? you need create event handler functions in javascript dialog. an example http://abani-behera.blogspot.com/2013/10/attach-listeners-to-widgets-in-cq5-aem.html (cq5 style extjs dialogs) s.o. dialog events: explain extjs 4 event handling aem widget documentation: https://docs.adobe.com/docs/en/aem/6-1/develop/components/widgets.html extjs documentation: https://docs.adobe.com/content/docs/en/cq/5-6-1/widgets-api/index.html alternately, touchui example @ https://helpx.adobe.com/experience-manager/using/creating-touchui-events.html (skipping details because sounds aren't using touchui dialogs @ time).

cobertura - Maven : generate only report -

i have pom.xml <reporting> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-pmd-plugin</artifactid> <version>3.0.1</version> <reportsets> <reportset> <reports> <report>pmd</report> <report>cpd</report> </reports> </reportset> </reportsets> </plugin> <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>cobertura-maven-plugin</artifactid> <version>2.5.2</version> </plugin> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-report-plugin</artifactid> <version>2.14</version> </plugin> </plugins> when use mvn site ,it generate me fuuly website want generate reports. who can me provi

java - printing a split string -

i trying print string in following format. ua, login, login ---> ua, navigation, fault average = 500 milliseconds . storing 2 strings 1 string called keystring , putting hashmap seperated "|" . splitting when iterating on keyset in format stated showing ---> ua, ctiq, export|ua, ctiq export, transfer average = 600 milliseconds . ideas? public static void processlines(map<string, numberholder> uacount,string firstline, string secondline) throws parseexception { string [] arr1 = firstline.split("-- ", 2); string [] arr2 = secondline.split("-- ", 2); string str1 = arr1[1]; string str2 = arr2[1]; ...... string keystring = str1 + "|" + str2; numberholder hashvalue = uacount.get(keystring); if(hashvalue == null) { hashvalue = new numberholder(); uacount.put(keystring, hashvalue); } hashvalue.sumtime_in_milliseconds += diffmilli