Posts

Showing posts from April, 2013

python - Motif search with Gibbs sampler -

i beginner in both programming , bioinformatics. so, appreciate understanding. tried develop python script motif search using gibbs sampling explained in coursera class, "finding hidden messages in dna". pseudocode provided in course is: gibbssampler(dna, k, t, n) randomly select k-mers motifs = (motif1, …, motift) in each string dna bestmotifs ← motifs j ← 1 n ← random(t) profile ← profile matrix constructed strings in motifs except motifi motifi ← profile-randomly generated k-mer in i-th sequence if score(motifs) < score(bestmotifs) bestmotifs ← motifs return bestmotifs problem description: code challenge: implement gibbssampler. input: integers k, t, , n, followed collection of strings dna. output: strings bestmotifs resulting running gibbssampler(dna, k, t, n) 20 random starts. remember use pseudocounts! sample input : 8 5 100 cgcccctctcgggggtgttcagt...

wiki - PHP automatic footnote and endnote generator -

this more of general information question involving endnotes "check code" one. that's because can find no (useful) information on subject , don't have skills create myself. still think it's useful create general brainstorm session / forum thread on net this. the issue: i've written 60 articles, dozen of them book-length or near book-length on site has been manually designed html5, css3, jquery , php - latter 2 pre-existing code. i'm happy except 1 thing: endnotes! takes forever update them. an average article has 120 endnotes (up 550). happens frequently, during writing/proofreading process, need add more information or want additional endnote. means anywhere 2 30 minutes of copy-pasting "[113]s", "[114]s" around. it's hopelessly inefficient. ordinarily dislike uninspirational wiki cms platforms, have 1 huge benefit: cite.php plugins. one: https://www.mediawiki.org/wiki/special:extensiondistributor?extdist_name=cite...

java - Retrieving Session Attributes after Session Times Out -

i have spring mvc project setup define several model attributes & session attributes when user accesses home page home.html . homecontroller.java @requestmapping(value = "/gethomepage", produces = "text/html", method = requestmethod.get) protected modelandview gethomepage(httpsession session) { modelandview mav = new modelandview("home"); // stuff session.setattribute("attr1", "cool"); session.setattribute("attr2", "attributes"); return mav; } i grab these session attributes on separate orderform.html (i'm using thymeleaf template engine) session attribute 1: <div th:text="${session.attr1}"></div> session attribute 2: <div th:text="${session.attr2}"></div> this works fine until session timed out/invalidated , user still on orderform.html - lose scope of session attributes they're defined on home @controller can retrieve sess...

python - Split word containing unicode character -

i working on nlp project involving emojis in tweets. an example of tweets given here: "sometimes wish wa octopus slap 8 people @ once🐙" my problem once🐙 considered 1 word split unique word 2 tweet this: "sometimes wish wa octopus slap 8 people @ once 🐙" note have compiled regexp containing each emojis! i looking efficient way of doing since have hundreds of thousands tweets can't figure out start. thank you can't this: >>> import re >>> s = "sometimes wish wa octopus slap 8 people @ once🐙" >>> re.findall("(\w+|[^\w ]+)",s) ['sometimes', 'i', 'wish', 'i', 'wa', 'an', 'octopus', 'so', 'i', 'could', 'slap', '8', 'people', 'at', 'once', '🐙'] if need them single space-delimited string again, join them: >>> " ".join(re.findall("(\w+...

random unwanted symbols in char array in C -

im trying make array of strings using strcat() , keeps giving me unwanted characters, example: char arr[50] strcat(arr, "test") , when puts(arr) or printf("%s\n", arr) , gives me @!*test instead of test , know what's causing problem? thanks! you must initialize array before using value, or invoke undefined behavior . try this: #include <stdio.h> #include <string.h> int main(void) { char arr[50] = {0}; /* add = {0} */ strcat(arr, "test"); puts(arr); return 0; }

How do I use asterisk in lookbehind regex in python? -

my test string: 1. default, no hair, w/o glass 2. ski suit 3. swim suit how detect if there "no" or "w/o" before hair (there more 1 spaces in between)? the final goal: 1. default, no hair, w/o glass returns false 1. default, no hair, w/o glass returns false 1. default, w/o hair, w/o glass returns false 1. default, w hair, w/o glass returns true the goal tell whether glass should used or not. my attempt: (?<!no\s)hair ( http://rubular.com/r/pdkbmyxpgh ) you can see in above example, if there more 1 space, regex won't work. the re module not support variable length (zero width) look-behind. you need either: fixed number of spaces before hair use regex module short function using negative lookahead: def re_check(s): return re.search(r'^[^,]+,\s+(?!(?:no|w/o)\s+hair,)', s) not none >>> re_check('default, no hair, w/o glass') false >>> re_check('default, w/o hai...

elasticsearch - discovery.zen.minimum_master_nodes value for a cluster of two nodes -

i have 2 dedicated windows servers (windows server 2012r2, 128gb memory on each server) es (2.2.0). if have 1 node on each server , 2 nodes form cluster. proper value discovery.zen.minimum_master_nodes i read general rule in elasticsearch.yml: prevent "split brain" configuring majority of nodes (total number of nodes / 2 + 1): i saw thread: proper value of es_heap_size dedicated machine 2 nodes in cluster there answer saying: as described in elasticsearch pre-flight checklist, can set discovery.zen.minimum_master_nodes @ least (n/2)+1 on clusters n > 2 nodes. please note " n > 2 ". proper value in case? n number of es nodes (not physical machines es processes) can part of cluster. in case, 1 node on 2 machines, n = 2 (note 4 here ), formula n/2 + 1 yields 2, means both of nodes must eligible master nodes if want prevent split brain situations . if set value 1 (which default value!) , experience networking issue...

javascript - Jquery drag drop revert to original position and div on double click -

i have drag-and-drop items, intended dragged 1 div , dropped div . capture original position of each item in hidden fields when created. i want items go original div , location on dblclick , relocate inside drop target div . any ideas? <div id="cardpiles"> <div id="d1" class="draggable" ondblclick="rev(this)">1</div> <div id="d2" class="draggable" ondblclick="rev(this)">2</div> <div id="d3" class="draggable" ondblclick="rev(this)">3</div> <div id="d4" class="draggable" ondblclick="rev(this)">4</div> <div id="d5" class="draggable" ondblclick="rev(this)">5</div> <div id="d6" class="draggable" ondblclick="rev(this)">6</div> </div> function rev(me) { var b = $(me).text(); var h = $('#...

android - How to put Json data in spinners from URL? -

i getting json in text box tried put data in spinner unable so. below main activity class , using volley. public class mainactivity extends activity { private string urljsonarry = "https://www.abc.json"; private static string tag = mainactivity.class.getsimplename(); private button btnmakearrayrequest; // progress dialog private progressdialog pdialog; private textview txtresponse,txtresponse2,txtresponse3,txtresponse4; // temporary string show parsed response private string jsonresponse, jsonresponse2, jsonresponse3, jsonresponse4; spinner spinner; arrayadapter<string> adapter; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.spinners); spinner= (spinner) findviewbyid(r.id.spinner); btnmakearrayrequest = (button) findviewbyid(r.id.btnar...

javascript - Missing ) after argument list in SFDC -

i'm receiving following error "missing ) after argument list" when clicking on custom button in sfdc. aim of button launch specific case type in our internal , community environments. any appreciated! {!requirescript("/soap/ajax/28.0/connection.js")} {!requirescript("/soap/ajax/28.0/apex.js")} if('{!$site.prefix}'!=''){ window.open('{!$site.prefix}/500/e?returl=%2f500%2fo&recordtype=0121b0000004ikz,'_parent'); }else{window.open('500/e?returl=%2f500%2fo&recordtype=0121b0000004ikz,'_parent');} var qr = sforce.connection.query("select id recordtype (name= 'device request') , sobjecttype = 'case'"); try this: { !requirescript("/soap/ajax/28.0/connection.js") } { !requirescript("/soap/ajax/28.0/apex.js") } if ('{!$site.prefix}' != '') { window.open('{!$site.prefix}/500/e?returl=%2f500%2fo&recordt...

java - Why does javac create <init> method in class that doesn't create any instance -

Image
i have question related java compiler. example code: public class theclass { public static void main(string[] args) { system.out.println("hello world!"); } } when compile class can see in javaclassviewer , class contains <init> method invokes java.lang.object construcotr, not creating instance of class , no constructor called. jvm calls static method main, doesn't create instance of class. so, why compiler produces <init> method? understand if create object of theclass the jls requires default constructor generated : 8.8.9. default constructor if class contains no constructor declarations, default constructor implicitly declared. also: i not creating instance of class irrelevant. compiler can't know that.

Get the response headers from redirect url using node.js -

objective: te response.headers when status code 302 redirects uri response issue: i did bit of googling issue i'm facing @ end redirect url returning 500 rather expected 302. found npm request() can used redirects. i'm not able response headers returns 500. when used api end points manually postman (with interceptors turned on) along body , headers, able 302 redirects. used automation testing api request( url: 'https://blah/blah', client_id:'something.com.au' redirect_uri:'http://something' // used mobile app , ok have valid url response_type :'code' scope : 'allapi', username : 'cxxx' password : 'ccxcxc' headers : { 'content-type': 'application/x-www-form-urlencoded', 'followredirect' : true }, function (error, response) { console.log('the response val is', response.statuscode); }); question: not sure if npm request can justice ...

java - Limit number of prompted arguments -

i want prompt user input 2 numbers represent size nxn of board. if user write less 1 or more 2 numbers, program don't allow him , instead, handle exception. for example: public class tester { public static void main(string[] args) { scanner userinput = new scanner(system.in); system.out.print("board size nxn: "); int width = userinput.nextint(); int height = userinput.nextint(); } } how can achieve using try-catch block limiting user input 2 numbers? public class tester { public static void main(string[] args) { scanner userinput = new scanner(system.in); system.out.print("board size nxn: "); try { int width = userinput.nextint(); int height = userinput.nextint(); if (userinput.hasnext()) { throw new illegalargumentexception(); } } catch (illegalargumentexception e) { system.err.println("enter 2 numbers"); } } }

javascript - Chrome Extension Browser Action not Appearing -

i trying make extension google chrome, , in stages of coding it, icon browser action appear, i've added action it, won't show up. manifest.json here: { "manifest_version": 2, "name": "test", "description": "test extension" "version": "0.1", "background": { "scripts": ["background.js"], "browser_action": { "default_icon": "icon.png" } } } you missing , after description entity, , put } @ wrong place. { "manifest_version": 2, "name": "test", "description": "test extension", "version": "0.1", "background": { "scripts": [ "background.js" ] }, "browser_action": { "default_icon": "icon.png" } }

osx - OpenGL created window size twice as large -

i'm running learn opengl tutorials on macbook pro 2015. generated window dimension twice large set. (e.g., set 800x600 in code, got 1600x1200). , triangle code tries draw in lower left quadrant, when it's supposed in center. what might reason this? i ran code , didn't make change. link screenshot. from glfw faq : 4.3 - why output in lower-left corner of window? you passing window size, in screen coordinates, glviewport, works pixels. on os x retina display, , possibly on other platforms in future, screen coordinates , pixels not map 1:1. use framebuffer size, in pixels, instead of window size. see window handling guide details.

c++ - std::stringstream.str() outputs garbage -

i need save bunch of image files numbered indices. trying construct these filenames using stringstream. however, stringstream.str() not seem return filename, rather returns garbage. here code: std::stringstream filename; filename << filepath << fileindex << ".png"; bool ret = imwrite(filename.str(),frame, compression_params); fileindex++; printf("wrote %s\n", filename.str()); here output 1 execution: wrote ╠±0 wrote ╠±0 wrote ╠±0 wrote ╠±0 here output execution: wrote ░‗v wrote ░‗v wrote ░‗v wrote ░‗v any suggestions? imwrite opencv function, , have [code]using namespace cv;[/code] @ top of file - there interference between opencv , std? you can't pass non-pod type std::string c-style variadic function printf . you use c++ output: std::cout << "wrote " << filename.str() << '\n'; or, if old-school weirdness, extract c-style string c-style output: printf("write %s\n...

App Engine Endpoints DOWN -

i use google cloud endpoints application. whenever hit application root, gives error. console says: importing endpoints google.appengine.ext deprecated , removed. add endpoints library app.yaml, endpoints can imported "import endpoints". there no mention of in documentation , believe doing correctly. i tried adding endpoints library section of app.yaml , deployment failed saying wasn't valid library. when in instance page, says instances running on app engine 1.8.5 , pre-release version hasn't come out yet! is google problem or code? the message you're seeing warning, not error. endpoints running on python 2.7 continue work without code changes. however, may seeing error if you're trying run endpoints on python 2.5. no longer work, , unfortunately not communicated prior release. resume use of endpoints, you'll need update application python 2.7.

r - Accessing a matrix defined by paste (character string) -

i've created series matrices pasting county value based on loop word matrix. worked: assign(paste("matrix",sort(unique(data$county), decreasing=false)[k],sep=""), matrix(0,100,100)) i want write different cells in matrix cannot. fails: assign(paste("matrix",sort(unique(data$county), decreasing=false)[k],sep="")[j,i],1) the error in paste() since has "incorrect number of dimensions" since paste produces vector , [j,i] trying access matrix. i've tried wrap paste in get(), eval(), etc. different errors. so question how make character string return matrix can access [j,i]? you can use code scheme instead: save list of counties, sorted want ( decreasing=false default): counties <- sort(unique(as.character(data$county))) create zeroed matrices per county: matrices <- sapply(counties, function(.)matrix(0,100,100), simplify=false) write specific cells: matrices[[counties[k]]][j,i] <- 1 n...

css3 - canvas is not displaying properly in IE10 with max-width:100% -

css: canvas { max-width: 100%; } html: <canvas id="spades" width="240" height="320" style="background-color:white;border-radius:10px"> the above css not working in ie10, height replaced width supply. appricited are trying resize canvas full page size? your max-width used define theoretical maximum width of canvas, not cause canvas resized. anyway... don't use css resize canvas because canvas drawings distorted. that's because browser responds css canvas resizing "stretching" existing canvas pixels. instead, resize in javascript setting width of canvas element itself. var canvas = document.getelementbyid('mycanvas'), canvas.width = window.innerwidth; canvas.height = window.innerheight;

Android passing file path to OpenCV imread method -

i trying use opencv in android project , trying run native code don't know how use parameter jniexport jint jnicall java_com_example_helloopencvactivity_nativecalls_filepath (jnienv * env, jobject jo, jstring str1, jstring str2) { cv::mat img1 = cv::imread(""); } i tried using this const char *nativestring = (*env)->getstringutfchars(env, str1, 0); cv::mat img1 = cv::imread(nativestring); but getting error error: no matching function call '_jnienv::getstringutfchars i need pass file path android file system opencv's native code processing, passing element string , should read imread first in java side, codes looks like: private string path="/mnt/sdcard/"; initfeature(width,height,path); public native void initfeature(int width, int height,string path); then in jni side, it's: //passed java part , release after initfreature const char* npath; //to save globle path char* g_path; jniexport void jnicall java_...

jquery - Can't get PHP variable through AJAX -

i using wordpress , have page have drop down when links clicked make ajax call , pass data variable php, @ least i'm attempting lol. when clicking on link check browser , in network tab page receive variable data object in html , ajax post's php page reason can't value. my html <div class="category-submenu"> <ul> <li><a href="#" data-office="corporate">corporate</a></li> <li><a href="#" data-office="office1">office1</a></li> <li><a href="#" data-office="office2">office2</a></li> <li><a href="#" data-office="office3">office3</a></li> </ul> </div> my jquery $('.category-submenu a').click(function(){ $.ajax({ type: "post", url: "/load-team.php", datatype: 'js...

Getting errors on trying to declare a class in java -

i got part of code: import java.util.*; import java.io.*; public class oblig2 { meny menyen = new meny(); public static void main (string[] args) { scanner input = new scanner (system.in); int menyvalg=0; //lager filen ved navn fugleobservasjoner try{ printwriter fil=new printwriter(new filewriter("fugleobservasjoner.txt")); } catch (ioexception e) { system.out.println("filen finnes ikke"); } //selve menyen til programmet en egen klasse. class meny { int menyvalg=0; void meny() { system.out.println("====== meny registrering av fugleobservasjoner ====="); system.out.println("\n1. registrer en fugleobservasjon"); system.out.println("2. skriv ut alle fugleobservasjoner av en type"); system.out.println("3. skriv ut alle fugleobservasjoner på ett bestemt sted"); system.out.println("4. avslutt systemet"); system.out.println("\nvennligst velg et tall: "); menyvalg = input.nextint();...

javascript - XMLHttpRequest prototype of onreadystatechange not called -

i'm trying detect when ajax call finishes in uiwebview. modified code in answer: javascript detect ajax event best of abilities. here attempt: var s_ajaxlistener = new object(); s_ajaxlistener.temponreadystatechange = xmlhttprequest.prototype.onreadystatechange; s_ajaxlistener.callback = function () { window.location='ajaxhandler://' + this.url; }; xmlhttprequest.prototype.onreadystatechange = function() { alert("onreadystatechange called"); s_ajaxlistener.temponreadystatechange.apply(this, arguments); if(s_ajaxlistener.readystate == 4 && s_ajaxlistener.status == 200) { s_ajaxlistener.callback(); } } i'm injecting webview alert never firing. if place alert @ beginning or end of script, it'll fire i'm there no syntax errors. i'm not js guy i'm hoping trivial problem. putting generic onreadystatechange in xmlhttprequest.prototype didn't work me. code linked can adapted invoke custom f...

c - Strange performance issue with AMD's ACML BLAS/LAPACK library -

i asked question on @ amd developers forum few days ago, haven't gotten answer. maybe here has insight. http://devgurus.amd.com/thread/167492 i running acml version 5.3.1, libacml_mp gfortran_fma4 on opteron 6348 processors on ubuntu 12.04. what happens performance of call dsyev (eigen decomposition) slows down dramatically (by factor of 10+) if first make call dpotrf (cholesky decomposition). makes no sense @ me why happen. maybe there kind of cache need clear or that. here simple c program reproduces problem. #include <stdio.h> #include <stdlib.h> #include <acml.h> #include <time.h> int main(void) { double * x = malloc(1000000 * sizeof(double)); double * y = malloc(1000000 * sizeof(double)); double * eig0 = malloc(1000000 * sizeof(double)); double * eig1 = malloc(1000000 * sizeof(double)); double * eigw = malloc(1000 * sizeof(double)); double * chol = malloc(1000000 * sizeof(double)); clock_t t0,t1; int info; int i; /...

java - How to prevent the user to go back on login page by clicking on back button of browser in jsp? -

i building web application in jsp through mvc approach! in app once user logged in through login.jsp page , redirected adminpanel.jsp if click button again can view login.jsp page. want once user logged in , click button or manually enter adminpanel.jsp url in browser must redirected adminpanel.jsp page! have done following login page. works after user manually enter url after logging in e.g localhost:8080/ert/login.jsp redirects adminpanel.jsp if logged in already. if press button dont redirect adminpanel.jsp go login.jsp.. <body> <% if(session.getattribute("id")!=null) { response.sendredirect("adminpanel.jsp"); } %> <%!string errormsg; %> <form action = "adminlogin" method = "post"> username : <input type = "text" name = "username"/ ><br /> password : <input type = "password" name = "password"/><br /> <input type = "submit...

asp.net web api - Invalid ModelState with null parameters -

playing new webapi 2.0 rc1 prerelease bits... given method: [httpput("{sampleform}/{id?}")] public httpresponsemessage putsampleform(sampleform sampleform, int? id) { if (!modelstate.isvalid) { // handle invalid model } // insert valid model db ef return request.createresponse(httpstatuscode.ok); } it marked nullable id, if id in fact null, modelstate flagged invalid well... expected, or there can let modelstate know needs ignore nullable parameters? yes use question mark on property of model also, this: private int? id {get; set;}

java how to convert a int[][] to an BufferedImage -

i have 2d integer array, bufferedimage method "getrgb()". when try convert 2d integer array bufferdimage, black picture. this method bufferedimage bufferedimage = new bufferedimage(width, height, bufferedimage.type_int_rgb); (int = 0; < matrix.length; i++) { (int j = 0; j < matrix[0].length; j++) { int pixel=matrix[i][j]; system.out.println("the pixel in matrix: "+pixel); bufferedimage.setrgb(i, j, pixel); system.out.println("the pixel in bufferedimage: "+bufferedimage.getrgb(i, j)); } } give output: the pixel in matrix: 0 pixel in bufferedimage: -16777216 pixel in matrix: 721420288 pixel in bufferedimage: -16777216 pixel in matrix: 738197504 pixel in bufferedimage: -16777216 pixel in matrix: 520093696 pixel in bufferedimage: -16777216 pixel in matrix: 503316480 pixel in bufferedimage: -16777216 why every pixel "-16777216"? thanks! update the method ...

Java Server-Client Socket trouble (updated) -

i managed make example of want program be. problem can't make socket connection work (the way want work). , don't know problem here. public class testchat extends frame { public static panel1 p1; public static panel2 p2; public static testchat tc; public testchat() { super(); setpreferredsize(new dimension(800, 600)); setlayout(new borderlayout()); addwindowlistener(new windowadapter() { public void windowclosing(windowevent we) { system.exit(0); } }); p1 = new panel1(); p2 = new panel2(); add(p1); } public static void main(string[] args) { // todo code application logic here tc = new testchat(); tc.pack(); tc.setvisible(true); ///* try { testchat.p2.run(); } catch (ioexception ioe) { system.out.println("io here"); } //*/ } public void change(int to) { if (to == 1) { tc.remove(p2); tc.add(p1); } if (to == 2) { t...

javascript - How to avoid "The operation is insecure" error when accesing opened window -

i'm trying open new window , fill data ready copyed in clipboard, printed or saved hard drive. i'm doing through greasemonkey user script . simplified version of script: window.addeventlistener("load", function() { /*export data*/ //create button var button = document.createelement("input"); //call actual export function button.onclick = function() {window.exportujrozvrh();}; //i tried this: //button.onclick = (function() {window.exportujrozvrh();}).bind(window); button.value = "print data in new tab"; button.type = "button"; //append button node getelementbyxpath(tisk_path).appendchild(button); }); window.exportujrozvrh = function() { //create new tab (or window if tab not supported) var okno = window.open(); //no url should fine same origin policy, shouldn't it? //check if popup exists if(okno==null) alert("popup blocked."); //write data o...

ios - How can I convert a local phone number to the international format in an iPhone app? -

i developing iphone app. @ 1 point, user types phone numbers. these can in format, international or local. local format 514-123-4567 (or worse, 123-4567 ), there way convert local phone numbers international format (e.164): +15141234567 ? means finding out country (and perhaps region too, if possible). one way require user enter phone numbers using international format, or select country she's in. if can avoid that, think more user friendly. i avoid asking user authorization geolocate her: lot of users refuse geolocation. ideally, country , region of own phone number. or perhaps current carrier's country (in case user roaming in country hers). but if installed app on ipod or ipad without sim card? maybe use locale? or try geolocate ip address? any better ideas? for "converting" phone numbers - have example here: stphoneformatter you can use nslocale determine how localize customer - not allays determine user (locale , language both us...

java - Android tablelayout click listener for cell content -

i have 3x3 gridview custom linearlayouts within. want layout , search on internet it's not possible gridview because of column span. used gridview because of onclicklistener method: when user click on 1 of grid cell, new activity starts(not same activity, it's main menu). possible in tablelayout? if click on cell if spanned can call onclick method? i've searched web solutions, of i've found clicking on tablerow(which not me if there 3 custom layouts in 1 row). my layout tablelayout: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@android:color/background_light" android:orientation="vertical" > <imageview android:id="@+id/headerpicture" android:layout_width="fill_parent" android:layout_height="wrap_content" android:contentdescription="@st...

c# - Why does Code Analysis in VS2013 RC lead me into a box canyon? -

i ran code analysis on utility i'm maintaining, , advised me change this: private static extern int readmenu1file(string menu1path); ...to this: private static extern int readmenu1file(unmanagedtype.lpwstr menu1path); ...with verbiage: "specify marshaling p/invoke string arguments reduce security risk, marshal parameter 'menu1path' unicode, setting dllimport.charset charset.unicode, or explicitly marshaling parameter unmanagedtype.lpwstr. if need marshal string ansi or system-dependent, specify marshalas explicitly, , set bestfitmapping=false; added security, set throwonunmappablechar=true." ...but when did, says, " the type name 'lpwstr' not exist in type 'system.runtime.interopservices.unmanagedtype' " , " 'system.runtime.interopservices.unmanagedtype.lpwstr' 'field' used 'type' " code completion not helping (no suggestions after typing "unmanagedtype.") nor there context me...

c# - .get List<string> from controller method and display -

i new asp.net mvc , jquery , trying pull following off. trying list<string> , display it. , in response have following system.collections.generic.list 1[system.string]` in case 'lable1' contains. what doing wrong? should do? in controller: public list<string> search(string input, searchby searchby) { manager manger = new manager(); list<string> mylist = manger.getdata(input, searchby); return mylist; } in view: $('#ii-search').click(function () { var number = $('#input').val(); var typeen = 'ccc'; $.ajax({ url: '@url.action("search", "initiateinspection")', data: { input: number, searchby: typeen }, cache: false, success: function (data) { (var = 0; < 4; i++) { $('#lable1').html(dat...

c# - Why is this HTTP post not working on the website? -

i trying make post on website, adds log. when through browser, works, , when through program, nothing added. i "200" response in both browser , program. textview in fiddler (on browser): utf8=%e2%9c%93&authenticity_token=k32ch7taqi9piminqavegfs2len5aps5wkkcb3ep%2bj8%3d&message%5btext%5d=hej&commit=send textview in fiddler (my program): utf8=%e2%9c%93&authenticity_token=k32ch7taqi9piminqavegfs2len5aps5wkkcb3ep%2bj8%3d&message%5btext%5d=hej&commit=send raw (my browser): post url http/1.1 host: www.website.com connection: keep-alive content-length: 121 accept: */*;q=0.5, text/javascript, application/javascript, application/ecmascript, application/x-ecmascript origin: http://www.website.com x-csrf-token: k32ch7taqi9piminqavegfs2len5aps5wkkcb3ep+j8= user-agent: mozilla/5.0 (windows nt 6.2; wow64) applewebkit/537.36 (khtml, gecko) chrome/29.0.1547.76 safari/537.36 x-requested-with: xmlhttprequest content-type: application/x-www-form-urlenco...

gradle - Error when compiling Facebook Android SDK sample app -

i followed guide on official facebook developers site: https://developers.facebook.com/docs/getting-started/facebook-sdk-for-android-using-android-studio/3.0/ and when im trying build first sample app im getting error: gradle: error while executing dx command gradle: unexpected top-level exception: gradle: java.lang.illegalargumentexception: added: landroid/support/v4/widget/cursoradapter$1; gradle: @ com.android.dx.dex.file.classdefssection.add(classdefssection.java:123) gradle: @ com.android.dx.dex.file.dexfile.add(dexfile.java:163) gradle: @ com.android.dx.command.dexer.main.processclass(main.java:490) gradle: @ com.android.dx.command.dexer.main.processfilebytes(main.java:459) ... gradle: 1 error; aborting gradle: execution failed task ':abcd:dexdebug'. i think happens because there android-support-v4 included in facebook sdk, , project somehow wants include , tried remove - didnt help. my project's build gradle: buildscript { repositories { mavencent...

printing - Setting up USB-serial Receipt Printer (epson tm-t88ii/iii compatible) on Debian Wheezy -

i'm trying receipt printer working on debian wheezy. on being plugged computer, usb-serial receipt printer (epson tm-t88ii/ii compatible) tics question marks every few seconds, , not respond commands. the output printer is: ˥ ?????????????????£???≡█ attempting print echo fails error: /dev/ttyusb0: permission denied even root. attempting open cash drawer fails error: /dev/ttyusb0: no such device how stop tic , print? here's how got working: after sending: # echo "test" > /dev/ttyusb0 returns permission denied, # dmesg | tail returns: [92780.658576] ftdi_sio 2-3:1.0: ftdi usb serial device converter detected [92780.658624] usb 2-3: detected ft232bm [92780.658626] usb 2-3: number of endpoints 2 [92780.658628] usb 2-3: endpoint 1 maxpacketsize 64 [92780.658630] usb 2-3: endpoint 2 maxpacketsize 64 [92780.658632] usb 2-3: setting maxpacketsize 64 [92780.664556] usb 2-3: ftdi usb serial device converter attached ttyusb0 [92782....

SAS 9.1 - SAS Server Main vs. Local Libraries -

i'm working on older sas server (running 9.1). other users of system strictly use sas server; however, have need transfer data between , local sas server. when invoking libname statements, actual path of sas server listed , therefore fails resolve libname foo 'c:\mypathname\foo'; , instead seems regard libname foo '/server/longerpath/c:\mypathname\foo'. have handful of paths on sas server libname bar 'serverpath\bar' using well. possible access both local sas library sasmain server library? if you're running code on server, unless have sas/connect (are using rsubmit), need give server path access local machine if not on - may impossible, or may have unc path, \machinename\c$\foo\ , can access with. if you're using rsubmit, can access server's libraries (including work) using server= option on libname local machine prior rsubmit, and/or proc download or proc upload .

How Can I Run a legacy Classic ASP Site with Cybercash on 64 bit Windows Server 2008 R2 -

i have classic asp site running on old hardware , windows 2000. need migrate new hardware running windows server 2008 r2 64 bit. in particular, need reinstall ancient cybercash credit card clearing software. have merchant kit download, when try run mck-3.2.0.4-nt.exe, won't run because 16 bit app. how can around roadblock? i posted question answer it, because had this, , thought answers may of interest others. according techie @ paypal, many tens of thousands of sites still run cybercash. others may doing migration mine. the trick here recognize mck-3.2.0.4-nt.exe program unzip program. run on windows 2000 server, creating need in directory c:\mck-3.2.0.4-nt. classic asp need 4 files under c:\mck-3.2.0.4-nt\asp-api. may have been unzipped elsewhere, should able find , copy new server. there 4 include files: ccmckdirectlib.inc,ccmcklib.inc, ccmsw.inc, , ccvarblock.inc , subdirectory cychmck. include files should have been copied ever directory contains credi...

c# - Filter gridview according to user and its role - in .net 4 web appication -

i developing web site show grid view customers in left side. show customers db. user can click on customer show details. the customers , customers details taking sql db has tables customers , table of customersdata. i manage web site users roles using built in functionality of microsoft. created users role administrator , user role manager. i want manager see customers , not other manager's customers. i guess need associate customers managerid. but how do ? users roles not in db, in microsoft. customers table, managerid have have take microsoft db . there must way. appreciate ideas. thanks you can "userid" "aspnet_users" table based on "username". suggest add field customers table hold id. can query customers id of logged on user.

c# - Protection offered by using assembly StrongName? -

i strongname don't prevent reflection - that's job of obfuscator. beyond creating rather unique names, cryptographic purpose or protection of using strongnames? assume myassembly has internal classes , methods, exposed via [assembly: internalsvisibleto("myassemblytest, publickey=realrsapublickey")] to myassemblytest , testing assembly. both assemblies have strongnames, perhaps using same rsa key pairs. what prevents stripping signature on myassembly creating fake/dummy rsa key pair modifying assembly attribute [assembly: internalsvisibleto("myassemblytest, publickey=fakersapublickey")] re-signing myassembly own fake/dummy rsa key pair consuming internals inside own assembly, maliciousassembly i guess i'm not clear strongnaming's real duties ... appreciate insight. the primary purpose of giving assembly strong name preventing malicious users of else's code uses assembly substituting code own. consider situ...

css - How can I reduce this repetition -

i have css can see repeating same thing different categories...how can reduce code? .dropdown .cars-category{ float: left; margin-left: 1%; } .dropdown .trucks-category{ float: right; margin-right: 1%; } .dropdown .trucks-category > li > { display: block; clear: both; line-height: 20px; color: #546aa4; } .dropdown .trucks-category > li.last > { border-bottom-width: 0; } .dropdown .trucks-category > li > a:hover, .dropdown .trucks-category > li > a:focus, .dropdown .trucks-category > .active > a, .dropdown .trucks-category > .active > a:hover, .dropdown .trucks-category > .active > a:focus { color: #546aa4; text-decoration: none; background-color: #e7eded; outline: 0; } .dropdown .cars-category > li > { display: block; clear: both; line-height: 20px; color: #546aa4; } .dropdown .cars-category > li.last > { border-bottom-width: 0; } .dropdown .cars...

apache - Organize files in Web Inspector -

Image
the problem: whenever use web inspector (mostly in safari) , take @ resources used website occurs resources organized in directories. when open web inspector on own website files seem ordered randomly. example: left : twitter.com , right : website expected result: i'm looking way resources of website organized same way twitter has accomplished in given example. possible solutions (that i've tried): the logical answer organize files in directories. have placed css files in folder called css, did same images, fonts, etc. i have created sitemap linking these files bus doesn't work either. i assume has nothing amount files. problem occurs on website 1-10 files, on bigger website more files.

tfs - Are Team Foundation Server CAL licenses transferable? -

my organization serves application development needs number of different companies. when develop application company, typically have users company perform testing. if use tfs web access testing, able transfer cal license 1 company's tester once project has been completed? couldn't find in licensing whitepaper. from tfs licensing whitepaper : if contractor using client’s team foundation server client must supply team foundation server cal contractor’s use. cal purchased separately or cal included msdn subscription client assigns contractor temporarily. so yes, appears can transfer cals different users long 1 user using cal (accessing server) on given period. (i think "user" not locked down specific individual) however, this: team foundation server cals valid accessing team foundation server acquired same organization ...implies customers cannot use cals, have purchase own. it may possible (from reading of white paper) device...

php - Laravel searching many to many relationship -

i have many many relation between books table , authors table. pivot table (author_book) contains the author_id , book_id. i want users able search trough database using simple search form. whenever user enters keyword want search fields in both tables. what need this... return view::make('result')->with('books', book::with('authors') ->where('title', 'like', '%'.$keyword.'%') ->orwhere('**authors->table->name**', 'like', '%'.$keyword.'%')->get()); i need way search authors table , check keyword maches author name. the relation set in both author , book model. any appreciated this may not ideal solution complex queries find easier use raw sql queries. something in case: $result = db::select(db::raw("select * books inner join authors ...

java - Do we need to set a process variable to null in a finally block? -

if have following code: process p = null; bufferedreader br = null; try{ p = runtime.getruntime().exec("ps -ef"); br = new bufferedreader(new inputstreamreader(p.getinputstream())); //do br } catch (exception e) { //handle catch block } { //do need set p = null; } is p = null required in block or associated streams closed default? there's no need set process null , it'd idea explicitly close bufferedreader in finally block. or better, if using java 7 or above, consider using try resources automatically close stream.

javascript - Getting history.js to fire a function -

i want history.js work on homepage: http://www.dinomuhic.com/2010/index.php the main javascript code of homepage here: http://www.dinomuhic.com/2010/js/bunch.js my homepage self-coded, no cms, wordpress or whatever. whole site works this: whatever click on has id, id being send sndreq function , content appears. when click example on "motion" link being send javascript:sndreq('k001','main-menue','menue-open','motion') it's 4 vars. first id, 3 vars google analytics correct tracking. now did linked history.js script index page can see , added line sndreq function: history.pushstate( {state:1}, "dinomuhic.com - "+label, "?="+req ); i did nothing more . means did not add other lines of code history.js work. so works appends correct string url. clicking on motion button results in url string looking this: http://www.dinomuhic.com/2010/index.php?=k001 which good, because bookmarkable , sending id w...