Posts

Showing posts from June, 2015

inheritance - Java compiler error: "cannot find symbol constructor .."? -

i'm writing code employee, manager, hourly worker class assignment i've hit problem can't figure out, following code employee followed hourly worker. problem hourly worker won't compile, it's giving "cannot find symbol constructor employee" error when try compile (employee class compiiles without issue. suggestions please? think i've been staring @ long can no longer see problem! thanks. pieter. employee class - public class employee { public string firstname; public string lastname; public double hourlyrate; final static double normal_workweek = 37.5; public employee(string firstname, string lastname, double hourlyrate) { setfirstname(firstname); setlastname(lastname); sethourlyrate(hourlyrate); } //accessor , mutator methods employee's first name. public string getfirstname() { return firstname; } public void setfirstname(string firstname) { firstna

database - access: how to add a workorder to a customer -

i have noob question he, i'm learning :-) i'm making form following tables 1 tblcustomers , 1 tblworkorders . my question is: when add customer new record, person stored in table: tblcustomers going fine. the problem have table: tblworkorders , in table store technical information, sollutions , customers belongings. (adapter, notebook bag etc etc) my problem excists when example customer named john doe comes problem 2 weeks later. in table tblworkorders should 2 records problems of john doe think has relationships between tables, can tell me find example or when it's short story, how this? very difficult explain concept , start off scratch. prepared further research on different item. here place start: http://office.microsoft.com/en-us/access-help/guide-to-table-relationships-ha010120534.aspx the following how use tables: you need have common field in both tables (it can more 1 field, let's keep simple). easy way have customerid field dat

git - merge conflict when local is deleted but file exists in remote -

i new git , wondered how should go merge in local repo have deleted several files on master branch these files exist within remote master branch. after doing git-merge shows conflicts have occured. using git gui shows local file deleted, while remote branch file has contents. how stop these files being conflicted? there simple way using git gui? many thanks you should resolve conflicts see fit. if file supposed removed, , publishing change origin, remove again: git rm path/to/file if file should in fact tracked still, add (the version in work tree version origin): git add path/to/file after doing either of resolve conflict, commit merge.

c - How do I remove the first number from an integer? -

i need intake number like: 200939915 after doing this, know how, need remove first number becomes: 00939915 what best way this? char *c = "200939915"; char *d = c + 1;

Allocation and release of object within a method in Objective-C? -

i made move objective-c. doing exercises kochan's programming in objective-c 2.0 . on particular exercise, asked modify print method , optional argument: -(void)print{ nslog(@" %i/%i ", numerator, denominator); } for created print method take bool argument , modified existing print method follows: -(void)print{ [self printreduced:false]; } -(void)printreduced:(bool)r{ if(r){ [self reduce]; } nslog(@" %i/%i ", numerator, denominator); } but last part of exercise, supposed use bool determine if fraction should reduced or not (no problem testing flag), when reduced not supposed modify original object. allocated new fraction object inside printreduced method , released before end of method too: -(void)printreduced:(bool)r{ fraction *printingfraction = [[fraction alloc] init]; [printingfraction setto:numerator over:denominator]; if(r){ [printingfraction reduce]; } nslog(@" %i/%i ",[printingfraction numerator], [

What is latest version of itext that is not AGPL? -

what latest version of itext not agpl? can download it? maintaining it? this important programmers can pick correct version of itext project. [edit] question has been 6 years without being marked off topic. not single 1 of questions asked matter of opinion. not asking recommendation. question important developers evidenced number of people voting , helps them choose version of itext library want use. please reopen it. what's latest version: 2.1.7 last itext release under mpl & gpl. itext_4_2_0 wasn't released wild. 4.1.6 last itextsharp release under mpl & gpl. itext's version incremented match itextsharp, @ 5.0... along package name change , license change. those 2 put in same release deliberately, folks have consciously change software work new version... causing them notice new license. where can it? https://github.com/itext/itextpdf/tags and https://github.com/itext/itextsharp/tags who maintaining it? no one. we're

Unable to retrieve Sharepoint List Item With Workflow attached (In Progress, completed etc.) on it -

i using share point 2010, , using linq generated spmetal.exe. facing weird issue mentioned below sequence: 1: inserted new item (xx) in list (listname) 2: on insertion workflow starts , item (xx) status becomes "in progress" in items window. 3: if access row linq, threw exception "specified cast not valid" [nullreferenceexception: object reference not set instance of object.] microsoft.office.server.webcontrols.metadatanavtree.onunload(eventargs e) +40 system.web.ui.control.unloadrecursive(boolean dispose) +153 system.web.ui.control.unloadrecursive(boolean dispose) +306 system.web.ui.control.unloadrecursive(boolean dispose) +306 system.web.ui.control.unloadrecursive(boolean dispose) +306 system.web.ui.control.unloadrecursive(boolean dispose) +306 system.web.ui.control.unloadrecursive(boolean dispose) +306 system.web.ui.control.unloadrecursive(boolean dispose) +306 system.web.ui.control.unloadrecursive(boolean dispose) +306 system.

dllimport - Using C# dll in Windows phone 7 -

i've tried using c# dll in windows phone 7 occurs error after start debugging illustrated below. troubleshooding tips: if access level of method in class library has changed, recompile assemblies reference library. generral exception. this code.. -----------------windows phone 7----------------------------------------------- using system; ... using system.runtime.interopservices; namespace dllloadtest { public partial class mainpage : phoneapplicationpage { // constructor public mainpage() { initializecomponent(); } [dllimport("mathlibrary.dll")] public static extern int addinteger(int a, int b); private void button1_click(object sender, routedeventargs e) { messagebox.show("test " + addinteger(3, 4)); } } } ------------------------c# mathlibrary.dll---------------------------------- using system; using system.collections.generi

Exact replace of string in Javascript -

hidvalue="javascript:java"; replacestr = "java"; resultstr=hidvalue.replace("/\b"+replacestr+"\b/gi",""); resultstr still contains "javascript:java" the above code not replacing exact string java. when change code , directly pass value 'java' it's getting replaced correctly i.e hidvalue="javascript:java"; resultstr=hidvalue.replace(/\bjava\b/gi,""); resultstr contains "javascript:" so how should pass variable replace function such exact match replaced. the replace-function not take string first argument regexp-object. may not mix 2 up. create rexexp-object out of combined string, use appropriate constructor: resultstr=hidvalue.replace(new regexp("\\b"+replacestr+"\\b","gi"),""); note double backslashes: want backslash in regular expression, backslash serves escape character in string, you'll have double it.

sql server - Stored procedure execution time out problem -

i have created stored procedure.when execute in query analyzer takes 47 sec. web application throwing timeout exception. can modification in code or web.config file instead of doing changes in stored procedure resolve problem. i have following settings in config file <sessionstate mode="stateserver" stateconnectionstring="tcpip=127.0.0.1:42424" sqlconnectionstring="data source=127.0.0.1;trusted_connection=yes" cookieless="false" timeout="120"/> my code is: dim ds = new dataset() _dbcommand = _database.getstoredproccommand("getdetailsforall") _dbcommand.commandtype = commandtype.storedprocedure ds = _database.executedataset(_dbcommand) here if add 1 more line : _dbcommand.commandtimeout = 120 then problem solved. question have set timeout in web.config file. need add _dbcommand.commandtimeout = 120 line in code also. new answer based on updated question the timeout

struts String array order -

i using string array in jsp file. strut gurantee order in enetring data same when retriving data? string name[]; in jsp there multiple nos of propert 'name'. when retriving value in action class, order remian same? please me. though have not got error, still have doubt on this. thanks struts ensure order submitted browser maintained once form submitted server. order array values submitted browser browser, not struts, news standard indicates array values should submitted in same order appear in page, , every browser i've ever used correctly.

git merge - Resolving a part of conflict in a file in GIT -

the scenario discuss have merge repository shared repository developers cd resolve merge conflicts. there 2 or more merge conflicts in single file. each conflict has resolved different user. each developer cd repository resolve merge conflict. let foo.c has 3 merge conflicts one user resolves single conflict in foo.c , save in graphical merge tool now git recognizes "git add" though there still conflicts in other parts of file. if developer "git mergetool foo.c" doesnt pop foo.c conflicts. is there graphical tool resolves issue. allows multiple users resolve , save conflicts in same file. this scenario doesn't make sense... firstly, if there conflict, conflict exists on 1 merge commit, doesn't exist yet! (it's still on user's machine, possibly in index, not in local tree). the other users not have conflict @ all, until merge, or rebase. supposing have 3 users doing exact same merge, whatever reason may be, , therefore

Modifying an ArrayList in Java -

i want search through arraylst , delete entries same. for example if list was: apple, orange, banana, pear, peach, orange, then "orange" deleted (both occurances). naively, tried: for(string word : userlist){ for(string otherword : userlist){ ... } } where wrote how .remove(lastindexof(userword)) if equals word and indexes different. this led exception after exception, , realized manipulating list while iterating through making go wrong. so decided make copy of list arraylist<string> copylist = userlist; for(string word : copylist){ for(string otherword : copylist){ if(word.equalsignorecase(otherword) && copylist.lastindexof(word)!=copylist.lastindexof(otherword)){ userlist.remove(userlist.lastindexof(word)); userlist.remove(userlist.lastindexof(otherword)); } } } so tried this, , had similar problems. notably concurrentmodificationexception. after tweaking can't get, in head should easy process

How to unhook keyboard-hook using c# to develop a keystroke changing software -

i trying develop software take keyboard input, consume input , return other character inexchange of typed input. example, if type: "abcd" , define exchange rule russian alphabet expect output as: "ский". the code using follows: namespace hook_form { public partial class form1 : form { //keyboard api constants private const int wh_keyboard_ll = 13; private const int wm_keydown = 0x0100; private const int wm_keyup = 0x0101; private const int wm_syskeyup = 0x0105; private const int wm_syskeydown = 0x0104; private hookhandlerdelegate proc; private intptr hookid = intptr.zero; private delegate intptr hookhandlerdelegate(int ncode, intptr wparam, ref kbdllhookstruct lparam); private struct kbdllhookstruct { public int vkcode; int scancode; public int flags; int time; int dwextrainfo; } privat

objective c - iPhone: Screen not redrawing when I do something heavy _afterwards_ -

i want post message , picture twitter (using picture hoster). if user enters message alone , taps send overlay appears , shows "sending message twitter". if user adds picture doesn't show overlay. maybe because has convert jpg , thats heavy load? code looks this: [overlaymessage changetextto:nslocalizedstring(@"keysendtwitter", nil)]; overlaymessage.hidden = no; overlaymessage.locked = yes; // i've added these out of desperation :p [overlaymessage setneedsdisplay]; [self.view setneedsdisplay]; [self sendmessage]; it seems 2 messages (changetextto: , sendmessage:) running in parallel , sendmessage little bit faster doing heavy loading. require threading , app not multithreaded. or maybe setneedsdisplay: wrong message update screen before heavy loading? not 100% clear you're doing, sounds [self sendmessage] method blocking ui updating. makes sense if you're doing large synchronous network operation or image conversion. don't

html - Why isn't 'Vertical-align:bottom' working on this table -

this has been driving me crazy, sadly haha. can't figure out why can't make "x's" in table align bottom of table... i've tried putting vertical-align in different places in css, no avail :(. using correctly blank spots in table? here snips of both html , css files...any comments appreciated <html> <head> <title>day4: table king</title> <link rel="stylesheet" type="text/css" href="stylesday4.css" /> </head> <body> <table id="products"> <tr> <th><span></th> <th>free version</th> <th>lite version</th> <th>full version</th> </tr> <tr> <td>advertising</td> <td id="td">x</td> <td><span></td> <td><span></td> </tr> <tr class="alt"> <td>catering software</td> <td><span&g

css - li tag, IE7 and text in one line (row) -

i have text in <li> tags, , show text in 1 line. with firefox good, ie7, no. in ie7 must give <li> elements width . text can long or short. no me: width 50px; #menu_all li{ float:left; display: block-inline; padding:0; margin-left: 5px; } <div id="menu_all"> <ul> <li><span class="text">text</span></li> <li><span class="text">text2</span></li> <li><span class="text">text2 text text</span></li> </ul> </div> how make <li> menu show in ie7 on 1 line? thanks looks error in css. it's display: inline-block; not display: block-inline; . revised code: #menu_all li { float: left; display: inline-block; padding: 0; margin-left: 5px; } <div id="menu_all"> <ul> <li><span class="text">text</spa

C++: is it right to delete all declarations in public and private? -

i learning c++ , not clear destructor of class. example: class a: { public: int valuea; private: int valueb; }; a:~a() { delete valuea; delete valueb; } so, right delete every declarations in public , private? no, need delete has been allocated using new . simple value types int s never need deleted. if class did include data dynamically allocated using new either constructor or later other method destructor should typically de-allocate of it, regardless of wether data public or private. i might add having publically visible dynamically allocated pointer members might not best design, though.

erlang - Handling the return of the queue:out_r -

i have statement want remove last item in queue using out_r. the docs return result = {{value, item}, q2} | {empty, q1} q1 = q2 = queue() how handle if want queue item removed? how queue , disregard {value, item}? e.g. newqueue = queue:out_r(oldqueue) thanks use pattern matching! {_, newqueue} = queue:out_r(oldqueue) given both {value, item} , empty returned first element of tuple, ignoring first element want. note queue module supports 3 apis. other apis might want better. in case, can have same function, except crashes if queue empty: drop_r(q1) -> q2 returns queue q2 result of removing rear item q1. fails reason empty if q1 empty. picking 1 or other depends on applications , expect in queue, if can handle empty one, etc.

javascript - How to run PHP script in the back by a jquery button -

i need run php code file when click button jquery. code have: $(document).ready(function(){ $("#btnsubmit").button().click(function(){ alert("button 1"); $.ajax({ url: 'releasebackend.php', type: 'post', async: false, data: {}, datatype: 'xml', error: function(){ alert('error'); }, success: function(data){ //check error alert("success!"); } }); }); }); it shows alert of "error". have releasebackend.php file in same directory of javascript file. change $("#btnsubmit").button().click( to $("#btnsubmit").click( and check whether php page sending response or not. try getting error in error callback function using xmlhttprequest. error(xmlhttprequest, textstatus) { }

How to refresh a page in jquery? -

i need refresh page using jquery? using location.reload(true); this code reloads page need refresh page(once page refresh user entered content there). how refresh? use location.reload(); - note not disable caching reload. cannot preserve both form fields and reload without using cache. it's similar f5 vs ctrl+f5: first 1 not disable caching preserves form fields. latter not load cache , resets form fields.

Haskell int list to String -

i know if there simple way turn [5,2,10] "52a" . not case, want associate number >9 corresponding letter. thanks in advance. you want each element of list in order new list. in other words, want apply function (that have define yourself) each element. map function prelude for. to convert between integers , individual characters, use chr , ord functions data.char module. so, map (\i -> if < 10 chr (i + ord '0') else chr (i - 10 + ord 'a')) is function of type [int] -> string want (no error checking included, though).

pass data between Java and C -

i have c structure. struct data{ double value1[50]; double value2[50]; int count; }; i want map data java c structure.how can using jni? java code not programmed me. java programmer wants know in form should send me data? should expect more details i testing code filling structure instance csv file containing 2 columns. i want return 3 double values c code java application. provide following declaration java programmer: public native double[] dodata(double [] value1, double [] value2, int count); in c code able fill structure passed parameters. jni header this: jniexport jdoublearray jnicall java_package_classname_dodata(jnienv * , jobject, jdoublearray , jdoublearray, jint);

objective c - How to set a background image in view using Interface Builder -

hi want set background image view has several subview . my approach to: add uiimageview sibling subviews size of main view, , apply image view. all sibling views set background color have alpha of 0. make view transparent, not affect elements contain.

python - Problem with POST request from APE server module -

i use ajax push engine push engine , django main site. wrote server module must send request django-based application when new user join channel using http module. django-based project runs on local machine on local.jjjbbb.org. ape.addevent("join", function(user, channel) { var request = new http('http://local.jjjbbb.org/test- this/'); // test url request.set('method', 'post'); request.writedata('test-message', 'hello ape!'); request.getcontent( function(result) { ape.log(result); // code never work }); }); but code doesn't work, request doesn't receive. when change url else (like www.google.com or localhost example) works correctly , have result. when try send request application request doesn't work. problem when try send request server side, when use jquery sending client side works correctly. why cannot send post request server side domain? sorry, found problem. ape wo

rest - What is to prefer in Restlet: handleGet, handlePost OR represent, acceptRepresetation? -

imho, there 2 techiques handle query resource: for http can override represent(variant variant) or handleget() . for http post same applies acceptrepresentation(representation entity) , handlepost() . the doc handleget says: handles call automatically returning best representation available. content negotiation automatically supported based on client's preferences available in request. feature can turned off using "negotiatecontent" property. and represent : returns full representation given variant returned via getvariants() method. default implementation directly returns variant in case variants full representations. in other cases, need override method in order provide own implementation. what main differences between these 2 types of implementations? in case should prefer 1 on other? right can achieve e.g. handleget() work represent() ? i first started using handleget setting entity response. when implemented project used represent .

How do I get the username in Python? -

possible duplicate: is there portable way current username in python? how can username of account given script being executed? import getpass print getpass.getuser()

performance - Unexpected estimated rows in query execution plan (Sql Server 2000) -

if run query select user largetable largetable.user = 1155 (note i'm querying user reduce simplest case) and @ execution plan, index seek planned [largetable has index on user], , estimated rows correct 29. but if do select user largetable largetable.user = (select user users externalid = 100) [with result of sub query being single value 1155 above when hard code it] the query optimizer estimates 117,000 rows in result. there 6,000,000 rows in largetable, 1700 rows in users. when run query of course correct 29 rows despite huge estimated rows. i have updated stats fullscan on both tables on relevent indexes, , when @ stats, appear correct. of note, given user, there no more 3,000 rows in largetable. so, why estimated execution plan show such large number of estimated rows? shouldn't optimizer know, based on stats, it's looking result has 29 corresponding rows, or maximum of 3,000 rows if doesn't know user selected subquery? why huge estimate? pr

windows - How do I split a large xml file? -

we export “records” xml file; 1 of our customers has complained file big other system process. therefore need split file, while repeating “header section” in each of new files. so looking let me define xpaths section(s) should outputted, , xpath “rows” parameter says how many rows put in each file , how name files. before start writing custom .net code this; is there standard command line tool work on windows it ? (as know how program in c#, more included write code try mess complex xsl etc, "of self" solution better custom code.) "is there standard command line tool work on windows it?" yes. http://xponentsoftware.com/xmlsplit.aspx

jquery - How to put form labels on the right? -

please @ following comment form: http://jquery.bassistance.de/validate/demo/ i'd put labels on right of text input fields , display error messages under input fields. tried anything, no avail. :-( any appreciated! rain lover use error placement option of jquery validate plugin. take @ this question covering similar question.

c# - linq to xml, handling empty tags -

the following link statement works fine if source xml contains number or if tags missing. problem have when tags empty or if non-numeric value used. can statement modified handle these situations ? convert.toint32((string)data.elements("groupby").elements("depth").firstordefault() ?? "0") don't know of way solve linq if cannot guarantee content of xml document easier use int.tryparse()?, e.g. int result = 0; int.tryparse((string)data.elements("groupby").elements("depth").firstordefault(), out result);

c++ - Apply VST audio effect/plugin to audio-file -

this first question after leeching on here time.. spare me. i need apply izotope vinyl vst effect audio files via cli or c++ (so language doesn't matter), has work on mac or on unix based system. i've researched on webs , can't find working solution. i've tried using misswatson, command line utility, works result audio files silent... ./misswatson -plugin=vinyl -input-file="/users/sjaq/desktop/test.wav" -output-file="/users/sjaq/downloads/misswatson-v1.0-mac/res.wav" -parameter=1:0.6,2:0.6,11:0.4 then tried using steinberg vst sdk creating host application, starting vstvalidator provided sdk. when try load vst error: 2010-12-01 16:57:40.774 vstvalidator[4654:903] error loading /library/audio/plug-ins/vst/vinyl.vst/contents/macos/vinyl: dlopen(/library/audio/plug-ins/vst/vinyl.vst/contents/macos/vinyl, 262): no suitable image found. did find: /library/audio/plug-ins/vst/vinyl.vst/contents/macos/vinyl: no matching architecture in univ

c# - Listing all nested user controls from a master page on page load -

on page load there way enumerate nest user controls specific page load? i'd able enumerate user controls implement interface, , call interface method controls before asp.net passes control thier page_load events. the problem master page level, page in app loading, , each of them have random user control, , need type reference determine if implement interface, , call method. does have ideas? would work? void processcontrols(control control) { if(control imyinterface) //whatever interface name { (control imyinterface).methodname(); } foreach(control child in control.controls) { processcontrols(child); } }

c - How to create a process on Mac OS using fork() and exec() -

i working on relatively simple, independent " process starter " work on windows (xp, vista, 7), linux (ubuntu 10.10) , mac os x (10.6). linux , windows work, i'm having trouble mac version. hoping fork() , exec() functions work same way under mac os work in linux. first question is: should use these create process on mac or there platform specific functions used? my current code (which worked fine under linux) debug looks this: pid_t processid = 0; if (processid = fork()) == 0) { const char * tmpapplication = "/path/to/testapplication"; int argc = 1; char * argv[argc + 1]; argv[0] = tmpapplication; argv[1] = null; execv(tmpapplication, argv); }else { //[...] } any idea if work under mac os x well, because child process not being launched, while there no errors come up. thank you! the following program, adapted code, works fine me under os x: #include <stdio.h> #include <stdlib.h> #include &

python - how to avoid inheritance when using JAXB schemagen? -

i'm using jaxb annotations , schemagen maven plugin create xsd. need process xsd wsdl2py create python's client. have inheritance in classes, schemagen creates this: <xs:complextype name="b"> <xs:complexcontent> <xs:extension base="a"> <xs:sequence> <xs:element name="field1" type="xs:string"/> </xs:sequence> </xs:extension> </xs:complexcontent> </xs:complextype> for class: class b extends a{ @xmlelement(required="true") private string field1; } the problem wsdl2py doesn't understand xs:complexcontent , xs:extension. i'd generate xsd without inheritance. thanks in advance this shortcoming of wsdl2py rather jaxb, it's easy fix, using xslt or xquery. quick attempt fix in xslt: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="htt

.net - Massively multi-tenant programmable CMS? -

i have need massively multi-tenant cms allows customizability per site , per user. think myspace, it's single template tied profile of sort, allows user customize template want. by "massively" mean on realm of 100,000+ "sites", many have own domain, many subdomains of parent domain. the scale of multi-tenancy makes systems impractical because require custom configuration of each site. perhaps i'm looking kind of cms "toolkit" allow me build want, gives me tools so. i prefer .net oriented, work. does have pointers on projects or systems into? dotnetnuke. able thousands of sites off same code base. has bit of learning curve develop "modules" it, cms doesn't.

getscript - how to detect external js file is already being included using jquery -

i have included external js file using getscript. however, include once. how can detect whether external file has been included using jquery? thanks. this doesn't technically check if file has been loaded, can check object namespace defined within file. say js file namespaced code using like: var mynamespace = function(){ return { some:'stuff' }; }(); or style namespacing (ie jquery same thing) can check presence of mynamespace so if (typeof mynamespace == "undefined"){ // load script }

java - Android: decompress string that was compressed with PHP gzcompress() -

how can decompress string zipped php gzcompress() function? any full examples? thx i tried this: public static string unzipstring(string zippedtext) throws exception { bytearrayinputstream bais = new bytearrayinputstream(zippedtext.getbytes("utf-8")); gzipinputstream gzis = new gzipinputstream(bais); inputstreamreader reader = new inputstreamreader(gzis); bufferedreader in = new bufferedreader(reader); string unzipped = ""; while ((unzipped = in.readline()) != null) unzipped+=unzipped; return unzipped; } but it's not working if i'm trying unzip php gzcompress (-ed) string. php's gzcompress uses zlib not gzip public static string unzipstring(string zippedtext) { string unzipped = null; try { byte[] zbytes = zippedtext.getbytes("iso-8859-1"); // add byte array when inflater set true byte[] input = new byte[zbytes.length + 1]; system.arraycopy(z

Problem with jQuery selector by ID including other IDs -

i have 2 tables on page: #add , #items. #add has single row of inputs. #items has multiple rows. i'm saving inputs database. #add supposed save on button click whereas #items saves on blur. the problem #add inputs trying save on blur well. selector i'm using below working on #add table inputs #items table input. here sample of code (i can link source file if need be): $("#items tbody tr td input:not('[name=\"ext\"]')").live('focus',function() { $(this).attr("readonly",false); $(this).select(); curedit = $(this).val(); var name = $(this).attr('name'); if (name == 'item') { $(this).alphanumeric(); } else if (name == 'tag') { $(this).alphanumeric({allow:" "}); } else if (name == 'desc') { $(this).alphanumeric({allow:".,-()/ "}); } else if (name == 'qty') { $(this).numeric(); } else if (name == 'c

Single Sign On for Android Facebook -

friends, need know single sign on support facebook. have 2 applications on device , have post feed. login first time either 1 of applications, need continue using same login credential , session other application without showing login page. possible in android? if please guide me how implement it. thanks in advance. make sure both apps reference same facebook app client_id , client_secret . once user authorizes 1 of android apps, store access_token , , share between both apps.

mvvm - Communicate with a serial device in a WPF application -

i'm dabbling basics of communicating serial device within wpf application implementing mvvm design. right have hard loopback , expect receive characters sent. i have in past seen hints of win forms control this, , maybe framework class, right bit clueless can use in spirit of mvvm strategy. i bit confused , seems me might overthinking mvvm. mvvm presentation pattern; serial communication not presentation , doesn't matter presentation layer is. if , understand problem correctly, have class encapsulates serial communication. if expecting characters sent you, i'd have class expose basic "received" event. view model can use instance of class populate properties view attached to. hope helps.

java - Switch statement -

how can add conditions switch statement?(ex:-displaying grade average marks) i recommend using if-else... switch statements can compare on equality. with integer score, like... switch (score) { case 100: case 99: case 98: case 97: case 96: case 95: case 94: case 93: case 92: case 91: case 90: grade = 'a'; break; case 89: /* ... */ } see problem? :-)

visual studio - Free Source Control -

up until now, though lot of small home projects, have never used source control own projects. @ point of deploying first personal public website , figured time set up. 1 of main things looking version control (labelling etc). integration visual studio (2010) nice not essential. i realise free, not going tfs or similar, looking suggestions free source control. any ideas? i think git choice, see below link using git visual studio

OpenGL ES 2.0: Attribute not active -

in reading book: opengl es 2.0 programming guide (addison-wesley). , have read following: "attribute names not exist or not active in vertex shader attached program object ignored." when attribute not active? thanks. from opengl specification: a generic attribute variable considered active if determined compiler , linker attribute may accessed when shader executed. attribute variables declared in vertex shader never used not count against limit. in cases compiler , linker cannot make conclusive determination, attribute considered active. program object fail link if number of active vertex attributes exceeds max_vertex_attribs.

jquery - How to get the full path for a local file in Firefox 3 -

i'm working on intranet site, , able click on file (i'm not picky on how) , have server "know" filenme + path picked. local path relevent because server hosting application has same mapped network drive of clients, x:\someplace\something.txt same thing client , server side. the obvious way input type="file" etc method while disabling actual upload. best i've been able come using method, countless others, filename. note link in similar sounding question "accepted answer" involving onblur workaround broken. the tools i'm working ff3, python/pylons (using mako templates) server side, , jquery client side, , open can capture full path without user typing out. any ideas? tia, mike. do want this?if server supposed read file path,why not upload it? large takes unaceptable amount of time on intranet? anyway, can java applet embedded.

c# - Adding rows programatically to a DataGridView that is data bound? -

i have problem , can't seem able solve it. thought here able out. i have form has datagridview of customers. now, want add several customers datagridview without adding them database. because client must able create list of clients , when thats done add them @ once. i have tried this: string[] array = {"microsoft", "redmond", "something"} datagridview.rows.add (array); now can't done because exception saying in lines of you cant add rows programatically datagridview data bound . now have read can solved using table adapter insert rows instead of directly adding them via. dgv. not possible because use custom headers in dgv because existing data fetched via join's if add them via tableadapter exception doesn't match databases table schema. now lost... know of (halfway) elegant solution problem? thank you bind dgv bindinglist<yourobject> , yourobject can simple class properties reflecting database schema. pop

c# - How do I parse a log from a game with regex and/or linq? -

i'm looking elegant way parse this. i'm hitting wall when comes regex knowledge , maybe regex not best answer? i have 3 example sentences give example of want do. want to parse these 4 parts. attacker, attack-type, damage , target. gandalfs's heavenly wrath dismembers you! the holy prelate's slash wounds frodo. your divine power decimates evil warlock! attacker: 1 or several words first , words can identified either being "your" or end in 's. attack-type: 1 or several words can identified between "attacker" , "damage". damage: 1 or more (rare exists) words unique , limited. have list possible words. {"wounds", "decimates" etc}. not exists anywhere else no risk attacker named "wounds" or that. target: 1 or several words can identified words after damage. the following regex return match 4 captures each line: ^((?<attacker>your)|(?<attacker>.*?)'s)\s+

apache - mod_rewrite specific urls only -

mod_rewrite worst enemy , cant life of me figure out whats going wrong, scrapped htaccess content had in hope clever fools can dumb fool! we want 3 links re-written effects these. index.php?portfolio=print into portfolio/print and index.php?portfolio=branding into portfolio/branding and index.php?portfolio=illustration] into portfolio/illustration however dont want effect links such index.php?portfolio=photography. so ideally guess 3 lines 3 rules re-write links, base dir /new/. hope ya guys can :) thanks again! owen rewriterule ^portfolio/(print|branding|illustration)$ index.php?portfolio=$1 [l] this match describe using 1 rule 2 assumptions - no trailing slash or query string parameters. comment if expect either in urls. can add section appending capture.

geolocation - Android - find nearby places -

developing app on android. looking free rest api returns in xml format nearby places (just facebook places app on iphone does). want display of places returned on mapactivity - better have longitude-latitute in response. want store result address in free form, should part of response.. i want other api - give free-format address convert longitude-latitude. this: http://developer.yahoo.com/geo/placefinder/ you can use foursquare's api near venues. gps location on phone , use foursquare list of venues.

character encoding - Writing Russian text to txt file -

i trying write russian text, or cyrillic text, .txt file. can so, when open file written in place of text bunch of question marks. thinking encoding problem couldn't find in area help. have written little script demonstrates issue. do shell script "> $home/desktop/russian\\ text.txt" set text_path ((path home folder) & "desktop:russian text.txt" string) alias set write_text "Привет" tell application "finder" write write_text text_path set read_text text of (read text_path) end tell if has ideas why happening please let me know. thank you. i can't answer question. have lots of applescript coding issues in code none of them causing problem. applescript handles non-ascii text fine me. write in danish times , works. when tried script using russian got same results you. can't explain why. can see proper syntax reading , writing file here's code. note not use finder perform tasks , note how set path out

c# - How to remove Client Script Resource in the lifecycle? -

in base class, pre-render adds javascript page. in derived class, want replace javascript 1 of own resource script. if script being added in base class: this.page.clientscript.registerclientscriptresource(typeof(geomappingeditor), "somespace.resources.scripts.geomapping.js"); then can this: protected override void onprerender(eventargs e) { base.onprerender(e); //how overwrite javascript file here? } the reason why thought may possible because javascript added onto page key this: this.page.clientscript.registerclientscriptinclude("geomapping", this.apiscript); so know can add script in page "geomapping" being key , overwrite previous script. not seem there key "registerclientscriptresource". ideas on how achieve this? in base class, add virtual/overridable method register script, , in base class, override method , don't call base implementation. override it. also,

ANT is failing to find org.dbunit.ant.DbUnitTask -

so i'm writing ant build file run tests, , use following line without issue mxunit: <taskdef name="mxunittask" classname="org.mxunit.ant.mxunitanttask" classpath="../mxunit/ant/lib/mxunit-ant.jar"/> but when download dbunit-2.4.8.jar http://sourceforge.net/projects/dbunit/files/ , put in same directory mxunit-ant.jar , added following line ant build file: <taskdef name="dbunit" classname="org.dbunit.ant.dbunittask" classpath="../mxunit/ant/lib/dbunit-2.4.8.jar"/> for see warning in eclipse says: taskdef class needed class org.dbunit.ant.dbunittask cannot found: org/slf4j/loggerfactory when extract jar file have org.dbunit.ant.dbunittask class.. i'm confused ant complaining about.. idea issue is? it looks need make sure dependencies of dbunit satisfied, installing dbunit-2.4.8.jar. the specific error quote class org/slf4j/loggerfactory not being found suggests don't

string - Bash scripting, how to remove trailing substring, case insensitive? -

i modifying script reads in user email. simple, simple. echo -n "please enter example.com email address: " read email email=${email%%@example.com} # removes trailing @example.com email echo "email $email" this works, lower case @example.com. how modify remove trailing @example.com, case insensitive? if have bash 4: email=${email,,} email=${email%%@example.com} otherwise, perhaps use tr: email=$(echo "${email}" | tr "a-z" "a-z") email=${email%%@example.com} update : if wanting strip host (any host) perhaps want: email=${email%%@*}

xml - SOAP or REST for Web Services? -

is rest better approach doing web services or soap? or different tools different problems? or nuanced issue - is, 1 better in arenas another, etc? bounty-edit: now, 3 years later ask question again - offering bounty encourage indepth answer. appreciate information concepts , relation php-universe , modern high-end web-applications. i built 1 of first soap servers, including code generation , wsdl generation, original spec being developed, when working @ hewlett-packard. not recommend using soap anything. the acronym "soap" lie. not simple, not object-oriented, defines no access rules. is, arguably, protocol. don box's worst spec ever, , that's quite feat, he's man perpetrated "com". there nothing useful in soap can't done rest transport, , json, xml, or plain text data representation. transport security, can use https. authentication, basic auth. sessions, there's cookies. rest version simpler, clearer, run faster, , use l

c# - delete records in foxpro 2.x using oledb connection -

hi there first of im completed excited use first time incredible forum my question is, if knows how physically delete fox pro 2.x record c#.net using oledb connection, because used simple , standard delete sql statement 'delete table condition' , compiler throws me exception have sintax error. p.s. im mexican please considered english, im not pretty @ all. could show code used? simple delete table condition should indeed work fine. did use dbcommand .executenonquery() ? in general pattern this... idbconnection c = getyourconnectionornewoneup(); using (idbcommand cmd = c.createcommand()) { cmd.commandtext = "delete yourtable yourfield = 'value'"; cmd.executenonquery(); }

c# - How do draw FormattedText (if not in the onRender method) -

i draw ellipse , add them grid. then i'd add formattedtext each ellipse. getting rectanglebounds of ellipse. but following example: http://msdn.microsoft.com/en-us/library/bb613560.aspx#formattedtext_object i need drawingcontext draw text. if don't wantto override onrender, how can drawingcontext? you can use drawinggroup instead. has open method returns drawingcontext , can use construct drawing. you'll need arrange drawing appear in ui somehow. easiest way wrap in drawingbrush , use paint existing element in ui. example, if you've got ellipse called myellipse , set fill property drawingbrush based on drawinggroup contains single bit of formattedtext : var drawing = new drawinggroup(); using (var context = drawing.open()) { var text = new formattedtext("this text", cultureinfo.currentculture, flowdirection.lefttoright, new typeface("calibri"), 30, brushes.green); context

python - how do I clear a stringio object? -

i have stringio object created , has text in it. i'd clear existing values , reuse instead of recalling it. there anyway of doing this? tl;dr don't bother clearing it, create new one—it’s faster. the method python 2 here's how find such things out: >>> stringio import stringio >>> dir(stringio) ['__doc__', '__init__', '__iter__', '__module__', 'close', 'flush', 'getvalue', 'isatty', 'next', 'read', 'readline', 'readlines', 'seek', 'tell', 'truncate', 'write', 'writelines'] >>> help(stringio.truncate) on method truncate in module stringio: truncate(self, size=none) unbound stringio.stringio method truncate file's size. if optional size argument present, file truncated (at most) size. size defaults current position. current file position not changed unless position be

security - Is my site safe from XSS if I replace all '<' with '&lt;'? -

This summary is not available. Please click here to view the post.

java - How can I convert a .jar to an .exe? -

i want convert .jar .exe microsoft. there program converter this? also if there's 1 mac , linux appreciate suggestions too. launch4j works on both windows , linux/mac. if you're running linux/mac, there way embed jar shell script performs autolaunch you, have 1 runnable file: exestub.sh: #!/bin/sh myself=`which "$0" 2>/dev/null` [ $? -gt 0 -a -f "$0" ] && myself="./$0" java_opt="" prog_opt="" # parse options determine ones java , ones program while [ $# -gt 0 ] ; case $1 in -xm*) java_opt="$java_opt $1" ;; -d*) java_opt="$java_opt $1" ;; *) prog_opt="$prog_opt $1" ;; esac shift done exec java $java_opt -jar $myself $prog_opt then create runnable file jar: $ cat exestub.sh myrunnablejar.jar > myrunnable $ chmod +x myrunnable it works same way launch4j works: because jar has zip format , header located @ end of file. c

C++ - Alphabetizing Strings -

i reading information input file. of information, there name. information read struct. there array of these structs. i need alphabetize structs last name, using binary search tree. do need write operator overload function ==, <, , >. if can me started on that? operator overloads work functions or methods. return type , arguments in same way. instance, binary operator (like < ) member function 1 argument or free function two, 1 each each side of operator. thing that's different instead of having identifier function name, use special syntax, keyword operator followed operator being overloaded. if wanted have comparable type, way: class myusertype { private: std::string sort_significant; std::string sort_insignificant; public: bool operator<(const myusertype &) const; }; bool myusertype::operator<(const myusertype & other) const { return sort_significant < other.sort_significant; }

How to structure a PHP service that responds to Ajax requests -

i'm struggling design server-side script responds requests ajax application. in current state, app divided discrete pages (e.g., orders, items, finances, etc.). when switch between these pages actual webpage reload. each page has it's own "operator", required root operator.php , ajax requests directed. contained in each operator pattern: foreach ($actions $action) { switch ($action) { case 'get-items': [...] break; case 'get-item': [...] break; case 'update-item': [...] break; [...] } } the $actions supplied request, e.g. operator.php?page=items&action=get-item&id=123 . as application became more complicated, helped separate logic of each action from context action requested. i found use pattern when wanted use action's logic internally in php: $items = json_decode(file_get_contents('http://[...]/operator.php?action=get-items')); (

python - Is it possible to get the color of a particular pixel on the screen with it's X and Y coordinates? -

i color of particular pixel in python using x y coordinates, possible? this in windows, if makes difference. see http://rosettacode.org/wiki/color_of_a_screen_pixel under heading python they give: def get_pixel_colour(i_x, i_y): import win32gui i_desktop_window_id = win32gui.getdesktopwindow() i_desktop_window_dc = win32gui.getwindowdc(i_desktop_window_id) long_colour = win32gui.getpixel(i_desktop_window_dc, i_x, i_y) i_colour = int(long_colour) return (i_colour & 0xff), ((i_colour >> 8) & 0xff), ((i_colour >> 16) & 0xff) print get_pixel_colour(0, 0) which uses python extensions windows available python 2.3 3.1 @ http://sourceforge.net/projects/pywin32/files/pywin32/build%20214/

AJAX Rounded Corners extender not getting displayed in email in ASP.Net -

i have displayed below html source in page , mailed same. rounded corners extender present in html not displayed in email sent. <asp:panel id="pnldetails" backcolor="#f9f9f9" width="740px" runat="server"> <table width="100%"> <tr> <td> <span style="font-family: verdana; font-size: 11px; color: black; font-weight: bold;"> name:</span> </td> </tr> <tr> <td> <asp:label id="lblname" style="font-family: verdana; font-weight: normal; font-size: 11px; color: black; margin-left: 0px;" runat="server" text="-"></asp:label>