Posts

Showing posts from May, 2014

MYSQL Query for similiar data in multiple columns -

+-----------+----------+-----------+----------+ | contactid | fullname | firstname | lastname | +-----------+----------+-----------+----------+ | c01 | ash das | ash | das | | c02 | abhi das | abhi | das | | c01 | ash das | ash | ah | +-----------+----------+-----------+----------+ from above table need wite query provide similiar names table. can match frstname, lastname fullname. you may soundex function advised performances not optimal because indexes can't used mysql server kind of string functions. for example if fullname select c1.contactid,c1.fullname, c2.contactid, c2.fullname <contacttable> c1 inner join <contacttable> c2 on (c1.contactid != c2.contactid , soundex(c1.fullname) = soundex(c2.fullname))

ios - Push/Present a viewcontroller from right,the viewcontroller cover 3/4 part of previous viewcontroller -

i want this:i push or present viewcontroller called b, previous viewcontroller called a, b won't cover full screen, it's 3/4 width of screen's width,the left 1/4 width of turns dark,when tap area,b can dismissed,is possible? appreciate suggestions! why don't try out open source libraries achieve this. best library have come across swrevealviewcontroller there tutorial on appcoda featuring library. check out more info. fyi, if still prefer diy approach, take @ this .

Add iTextSharp.xmlworker.dll to use XML Worker -

i using html worker (itextsharp version 5.5.0) need change code use xml worker. i tried xml worker version 5.5.0 seems not support below namespace : using itextsharp.tool.xml; so tried download xml worker version 5.5.3 still not working. should remove previous itextsharp version 5.5.0 , add itextsharp version 5.5.3? could please advise? thanks i found issue. i removed itextsharp version 5.5.0 added xml worker version 5.5.3 , itextsharp version 5.5.3. it working now. xml worker more complicated html worker. i'm reading tutorials understand how use , replace html worker. please let me know if have instruction. thanks

java - Spring Data REST: How to retrieve many items using list of Ids in one single call? -

i can retrieve 1 single book spring data rest call such as: /book/{id} now, if know ids of 2 books , want retrieve them @ once? should call be? tried following returning me different books specified ones: get /book?ids=id1,id2 you declare query method in repository interface this: list<book> findbyidin(@param("ids") long[] ids); so can request books way: get /book/search/findbyidin?ids=1,6,9

dojo - EnhancedGrid not displaying all the rows in Google Chrome -

i have enhancedgrid displaying random number of rows. (number of rows depend on data fetched db). when loaded first time, if grid has more 10-12 rows, last 3 rows not getting displayed in grid. when checked browser console, data returned in json string. when select last displayed row in grid , press "down" key on keyboard, remaining records displayed in grid. happens in google chrome browser. works fine in ie. below declaration of enhanced grid. this._mygrid = new enhancedgrid({ id: "datagrid", nodatamessage:this.messages.no_results_were_found, errormessage:this.messages.grid_error_message }, document.createelement('div')); anybody has faced such error before? pointer appreciated. put widget inside dojo content pane, add scroll if child widget need more space. one big cause problem see putting dojo widget (whose height may vary) inside html div

http - Browser image caching confusion -

Image
some of images return these headers can tell me when image cache going expire , why? the cache-control value 1 used - image expire cache after 604800 seconds. see this question more detail. see here : when both cache-control , expires present, cache-control takes precedence

antlr - ANTLR4 custom tokens -

i using c# version generating antlr4 files. have used custom tokens using option tokenlabeltype=token . fine c# compiler gives error in match(..) , input(...) because not type cast custom tokens. whereas antlr3 gives proper casting functions. extending own token class antlr4.runtime.commontoken . c# compiler throws error cannot implicitly convert type 'antlr4.runtime.itoken' 'grammar.actionparser.token'. explicit conversion exists (are missing cast?)". please tell how resolve issue. is custom token class named 'token'? if so, check using statements make sure parser not confusing antlr4.runtime.token class token class. if not, change actual type of custom token class.

linux - Not able to build libtool 2.4.3 using gcc 4.8.2 on CentOS 6.6 -

background: made centos 6.6 x64 vm on vmware workstation 10. sudo yum update directly installed gcc 4.8.2 answer given here .set variables using scl enable devtoolset-2 bash downloaded libtool 2.4.3 wget http://gnumirror.nkn.in/libtool/libtool-2.4.3.tar.gz ./configure --prefix=/usr` sudo make build errors config.log $uname -a linux sphirewall 2.6.32-504.1.3.el6.x86_64 #1 smp tue nov 11 17:57:25 utc 2014 x86_64 x86_64 x86_64 gnu/linux

grails/hibernate: add pessimistic locking on using creteria -

i tried add pessimistic locking in creteria shown in doc http://grails.org/doc/latest/guide/gorm.html#locking had exception: "error util.jdbcexceptionreporter - feature not supported: "for update && join"; sql statement: ... org.hibernate.exception.genericjdbcexception: not execute query" i tried add lock in 2 places: def parentinstance = parent.createcriteria().get { childs { ideq(childinstance.id) lock true } and def parentinstance = parent.createcriteria().get { childs { ideq(childinstance.id) } lock true } additional question: right way use pessimistic locking association? thank you domain class parent{ static hasmany = [childs:child] } class child{ } datasource.groovy datasource { pooled = true driverclassname = "org.h2.driver" username = "sa" password = "&

python - Remove null fields from Django Rest Framework response -

i have developed api using django-rest-framework. using modelserializer return data of model. models.py class metatags(models.model): title = models.charfield(_('title'), max_length=255, blank=true, null=true) name = models.charfield(_('name'), max_length=255, blank=true, null=true) serializer.py class metatagsserializer(serializers.modelserializer): class meta: model = metatags response { "meta": { "title": null, "name": "xyz" } } ideally in api response value not present should not sent in response. when title null want response be: { "meta": { "name": "xyz" } } you try overriding to_native function: class metatagsserializer(serializers.modelserializer): class meta: model = metatags def to_native(self, obj): """ serialize objects -> primitives. "

java - DataNucleus Maven enhancer plugin error - class not found -

i'm running datanucleus enhancer plugin maven <plugin> <groupid>org.datanucleus</groupid> <artifactid>datanucleus-maven-plugin</artifactid> <version>${datanucleus.maven.plugin.version}</version> <configuration> <log4jconfiguration>${project.build.outputdirectory}/log4j.properties</log4jconfiguration> <verbose>true</verbose> <enhancername>asm</enhancername> <api>jpa</api> <fork>false</fork> <metadataincludes>com/mydomain/*.class</metadataincludes> <generateconstructor>true</generateconstructor> </configuration> <executions> <execution> <phase>process-classes</phase> <goal

java - Is it logical to use EJBs in a desktop application for doing business logic? -

currently i'm developing desktop application smart homes, app can read from/write serial port(here's business logic), store information on local database(which installed on same device). feature(and importantly) of app able set airdroid, every device connecting same wifi connect main device , control house.(by showing them html pages) here's i'm trying do: set application server glassfish. implement business logic(such write/read to/from serial port, handling database jobs(with orm) and...) ejbs. use ejb inside desktop application. logical or not? thank you. it logical. using ejbs many desktop applications implement business logic. if feel comfortable ejbs, rather other frameworks or standards, use it. of course, there pros , cons of doing so, topic, can find multiple discussions on , internet.

jquery - jqPlot Pie Chart highlighter -

i try use jqplot in jsp project. need draw pie chart. pie chart ok, works fine. then want show tooltip data when cursor on slice. these, can use highlighter provide jqplot, don't know how this. in .jsp file include <script language="javascript"src="../../common/jsc/plugins/jqplot.highlighter.min.js"></script> my javascript code: $(document).ready(function(){ var url = 'supplycalendardaydetailscharts.jsp?date=' + getel('date').value + '&action=cog'; $.ajax({ url: url, type: "get", datatype: "json", success: function(data) { var datatmp = []; (var in data) { var datapush = [data[i].cp_code, parseint(data[i].value)]; datatmp.push(datapush); } var plot1 = jquery.jqplot('chartdiv', [datatmp], { seriesdefaults: { // make pie chart. renderer: jquery.jqplot.pi

excel vba - VBA for executing something based on cell value -

i have spreadsheet have input formula in particular column gives me either yes or no. want code search column "yes" , wherever finds - should row number of cells give try: sub marine() each r in intersect(range("a:a"), activesheet.usedrange) if r.value = "yes" msg = msg & vbcrlf & r.row end if next r msgbox "yes found in rows " & msg end sub

treeview - How to find the all parent node of a child node from bottom to top in tree view control using vb.net -

Image
here have below treeview shown in image. for child node g g want fetch parent nodes name bottom top , store list. means in list should add g g, f f, d d, b b. please suggest solution. thanks in advance... this code obtain information parents node. dim selectednode treenode = yourtreeviewselectednode dim nodepath string= "" 'will store full path 'you full path of node 'parent\child\grandchild 'the procedure fill nodepath obtainnodepath(selectednode,nodepath) msgbox(nodepath) private sub obtainnodepath(byval node treenode, byref path string) if node.parent isnot nothing path = io.path.combine(node.text, path) ' parent\child if node.parent.level = 0 exit sub 'call again method check if can extract more info obtainnodepath(node.parent, path) end if end sub

parsing - C pass by reference "returns" incorrect content -

i want read values file using function , pass them main. file has specific format: string double char for example 2 lines: blahblah 0.12 g testtesttest 0.33 e i have following program. although values printed correctly in function, in main few of them printed. rest 0.00000 , no character printed well. doing wrong? #include<stdio.h> #include<stdlib.h> #include<string.h> int read_file(const char *filename, double **prob, char **sense); int main(){ double *iprob; char *sense; read_file("test.txt", &iprob, &sense); printf("main: %lf %c\n", iprob[0], sense[0]); return 0; } int read_file(const char *filename, double **prob, char **sense){ file *fp; char line[100], temp[80]; int = 0; fp = fopen(filename, "r"); if (fp == null){ fprintf(stderr,"file %s not found!\n", filename); return 0; } //*prob = (double *)malloc(sizeof(d

oracle - Apply a single case statement to all columns in sql -

i need sum of each column of table. used select sum(col1),col2 etc. if sum null, need 0, else value of sum. used "select case when sum(col1) null 0 else sum(col1) end sum_col1". i have around 40 such columns in table. need write " case when sum(col n) then..." 40 times in query? im working on oracle 9 g. thanks i have around 40 such columns in table. need write " case when sum(col n) then..." 40 times in query? short answer: yes. longer answer: might able use kind of dynamic sql generate statement automatically column metadata. might not worth trouble, can copy-paste statement in query editor. things considered, having table 40 columns need sum, indicates bad data model design. when working badly designed data model, pay price @ query time...

mysql - Pagination PHP addressbook -

i building table of users in domain. got table working , put little code pagination in keep getting errors... //connection $conn = new mysqli($servername, $username, $password, $dbname); // aantal per page $num_rec_per_page=30; //check connection if ($conn->connect_error) { die("connection failed:" . $conn->connect_error); } if (isset($_get["page"])) { $page = $_get["page"]; } else { $page=1; }; $start_from = ($page-1) * $num_rec_per_page; $sql = "select firstname, lastname, phone, department tl_member order lastname asc limit 30"; $result = $conn->query($sql); if ($result->num_rows > 0) { echo "<table><tr><br><hr><th align='left'>naam</th><th align='center'>telefoon</th><th align='right' >afdeling</th></tr>"; // output data in rows while($row = $result->fetch_assoc()) { echo "<

html - Disappearing content when adjusting browser window size -

i'm creating responsive website. when adjust browser screen size smaller 480 px wide, content (header , text) disappear. menu visible en changed smaller menu. html <!doctype html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta charset="utf-8"> <title>erlend van landeghem</title> <style type="text/css" media="screen"> @import "style.css"; </style> <link href='http://fonts.googleapis.com/css?family=special+elite' rel='stylesheet' type='text/css'> <script src="//use.typekit.net/dso8hgg.js"></script> <script>try{typekit.load();}catch(e){}</script> </head> <body> <div id="wrapper"> <div id="navwrapper"> <label for="show-menu" class="show-menu">show menu</label> <input type=&

c# - Accessing .Net enums in Iron python -

i'm trying access .net(c#) enums in ironpython , lets have test.dll // contains several enums enum testtype{..} enum testquality{..} .... .... enum teststatus{..} //similarly multiple functions public void starttest(testtype testtype, testquality testquality){..} .... .... public teststatus getteststatus(){..} and if try call above functions, need choose appropriate enum parameters , far did this, iron python [vs2012] import clr clr.addreference('test.dll') testdll import * test = test() # initiate enums enumtesttype = testtype enumtestquality = testquality .... .... enumteststatus = teststatus #call functions test.starttest(enumtesttype.basic, enumtestquality.high) .... .... # goes on now above ironpython code works fine, odd bit here need initiate enums(intellisence doesnt work here) before use them functions, become more difficult when there more enums use. whereas in c# environment(vs2012) dont have initiate can use them straight away when calling fun

button value in jquery -

$('.next').click(function(){ var buttonval = document.queryselector('input[name="quiz"]:checked').value; alert(buttonval); }) so works, i'd see how syntax in jquery. when click button class next , in alert notified value of radio button. i tried writing function in jquery in many ways, alert [object object] . not big of issue, since works, stubborn , can't solve on own. $('.next').click(function(){ var buttonval = $('input[name="quiz"]:checked')).val(); alert(buttonval); });

c# - .Net regex does not match/replcae pattern in multiline snippet -

i have following line: var snippet = @"lane\rhemel hempstead\rhp39pp\r\rphone\r+44772930000\remail\ramberlie_10371599_wright@yahoo.co.uk\r\r\rlookin" i replace phone number number of dots doing following: snippet = regex.replace(snippet, @"^[^\s](\(?\+?[0-9]+\)?)?[0-9_ \-\(\)]+$", "....", regexoptions.ignorecase); however nothing gets replaced, thought maybe not performing global search apparently .net regex global default. any ideas? can provide more information constraints? if want replace number on own line or without plus sign start, , newlines \r only, can use: var regexstring = @"\+?[0-9]+\\r"; var targetstring = @"lane\rfoo bar\rhp39pp\r\rphone\r+44772930000\remail\ranon_10371599_name@example.com\r\r\rlookin"; var result = regex.replace(targetstring, regexstring, "....\\r"); result: lane\rfoo bar\rhp39pp\r\rphone\r....\remail\ranon_10371599_name@example.com\r\r\rlookin this not general, f

php - Crypt generating *0 -

crypt is, sometimes, generating string *0 instead of real hash. const salt_byte_size = 24; const hash_payload = 13; public static function createhash($password, $cost = self::hash_payload) { $salt = '$2a$' . $cost . '$' . base64_encode(mcrypt_create_iv(self::salt_byte_size, mcrypt_dev_urandom)); $password = crypt($password, $salt); return $password; } i found line base64_encode(mcrypt_create_iv(self::salt_byte_size, mcrypt_dev_urandom)); somewhere around stackoverflow, stating way generate random salt. been few weeks couldn't find answer again. wonder if random salt maybe causing crypt generate string *0 . the given password alphanumeric string, 8 chars long. crypt returns *0 if given invalid salt - , that's case here. quoting the doc : blowfish hashing salt follows: "$2a$" , "$2x$" or "$2y$" , 2 digit cost parameter, "$" , , 22 characters alphabet "./0-9a-za-z"

Spring integration FTP: Stop file inbound-channel-adapter automatically when all source folder files are deleted -

is there configuration settings/expression stop channel adapter based on condition (i.e, stop channel adapter when source folder empty)? i can programatically below approach won't work in case. config: <file:inbound-channel-adapter prevent-duplicates="false" auto-startup="false" auto-create-directory="true" directory="${local.tmp.path}" id="fileinbound" channel="outputchannel" filename-pattern="*.xml"> <int:poller fixed-rate="${local.transfer.interval}" max-messages-per-poll="100" /> </file:inbound-channel-adapter> <sftp:outbound-channel-adapter id="sftpfileoutboundadapter" auto-create-directory="true" session-factory="sftpsessionfactory" channel="outputchannel" charset="utf-8" remote-directory="${ftp.path}"> <sftp:request-handler-advice-chain> <bean class="org.s

copy - iOS passing object between View Controllers with strong reference -

i have series of vc dedicated profile editing in navigation stack. go deeper custom object userprofile passed in -prepareforsegue . problem in configuration userprofiles seems pointing single object, , if button pressed after changes have been made current profile, profile in parent controller changed too. - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if ([segue.identifier isequaltostring:@"profiletoedit"]) { editprofiletableviewcontroller *editprofilevc = [segue destinationviewcontroller]; editprofilevc.userprofile = self.userprofile; editprofilevc.delegate = self; } each vc has property declared in it's .h file this: @property (strong, nonatomic) userprofile *userprofile; where userprofile simple class @interface userprofile : nsobject @property (strong, nonatomic) nsmutablearray *cars; @property (strong, nonatomic) nsstring *phonenumber; @property (strong, nonatomic) nsstring *name; @prop

java - how to get key of the most nearest value of a given double value from an existing map <String double> -

since need key values of double value i' m using bimap . bimap<string,double>mapobj = hashbimap.create(); mapobj.put("a1",3.58654); mapobj.put("a2",4.1567); mapobj.put("a3",4.2546); for particular value 4.0156 must key value a2.. if, double value=4.0156; mapobj.inverse().get(value)=a2 i tried many ways getting null, since there no exact match. please me... if have chosen wrong way please correct because i'm new in java. you have iterate through key-value pairs , select 1 value nearest value you're looking for. public string searchclosest(map<string,double> map, double value) { double mindistance = double.max_value; string beststring = null; (map.entry<string,double> entry : map.entryset()) { double distance = math.abs(entry.getvalue() - value); if (distance < mindistance) { mindistance = distance; beststring = entry.getkey(); } }

php - is str_random unique in laravel? -

i use str_random(60) function generate password reset code. question if thousand of people asked resetting password code unique or duplicated? public function postforgotpassword(){ $validator = validator::make(input::all(), array('email'=>'required|email')); if($validator->fails()){ return redirect::route('account-forgot-password')->witherrors($validator)->withinput(); }else{ $user= user::where('email', '=', input::get('email')); if($user->count()){ $user = $user->first(); $code = str_random(60); $password = str_random(10); $user->code = $code; $user->password_temp = hash::make($password); if($user->save()){ mail::send('emails.auth.forgot', array('link'=>url::route('account-recover', $code), 'username'=>$user->username,'password&

c# - Redirect to new tab in ASP.NET -

<asp:linkbutton id="lnkbtnprint" runat="server" onclick="lnkbtnprint_onclick" target="_blank"> </asp:linkbutton> i have button. need open new tab content on click. protected void lnkbtnprint_onclick(object sender, eventargs e) { if (!string.isnullorempty(hdnsubmissionid.value)) { sessionhelper.set(sessionkey.submissionid, hdnsubmissionid.value); response.redirect(publisherconfigurationmanager.navigation + "printable_submission_document.aspx"); } } i try apply answer post opening url in new tab case, text in top-left corner 'window.open...'. add _blank link - doesn't help. you dynamically redirecting based on triggered click. think scenario, change set href before click, since know data on page load, provided sample code complete. public void page_load() { if (!string.isnullorempty(hdnsubmissionid.value))

machine learning - Semantic Relations finding algorithms -

my final year project based on machine learning , natural language processing. implementing search bar write query of 2-3 words. after classification of text, want find out semantic relations between 2 words. for semantic stage - input - matrix of (rxc) rows words , columns contexts or paragraphs. , each cell have count of finding words contexts. output - yes or no. particular document. whether there in document. your answer not clear can give details main approaches in relation extraction (re) task: supervised re has employed kernel-based approaches : see link distant supervision introduced in bioinformatics : main idea of approach create own training data heuristically matching contents of relation repositories corresponding text (see link ) unsupervised re collect co-occurrences of word pairs strings between them, , calculate term co-occurrence or generate surface patterns (see link ) we can better if give more details labeled data , real goal of pr

sapui5 - Bind input field not work -

i have problem when try mapping model in view. have view view contains <form:simpleform minwidth="1024" maxcontainercols="2" editable="true" layout="responsivegridlayout" title="dimensione prodotto" labelspanl="3" labelspanm="3" emptyspanl="4" emptyspanm="4" columnsl="1" columnsm="1" class="editableform"> <label text="codice" /> <input value="{elements/idcodprod/value}" id="idcodprod" /> <label text="descrizione" /> <input value="{iddescprod/value}" id="iddescprod" /> <label text="famiglia" /> <input value="{idfamiglia/value}" id="idfamiglia" /> </form:simpleform> and model

php - Make homestead global in Windows OS -

i installed composer , added c:\programdata\composersetup\bin; path through config in windows. can access composer git globally. next installed homestead: composer global require "laravel/homestead=~2.0" the map automaticaly created in c:\users\bart\appdata\roaming\composer\vendor\laravel\homestead i added path path environment variable in windows access homestead globally. doesn't work did composer. what did wrong? the binary file (the executable on windows) put in c:\users\bart\appdata\roaming\composer\vendor\bin (this contains executables globally installed packages). you have add directory path file.

python - Python3.4-How to take a number out of a list and change to a float for math -

i have list of numbers inputted user. need able point spot in list. take number thats there, add it, , put new number in place. no matter how many different ways try tells me "typeerror: unsupported operand type(s) +: 'int' , 'list'". here code have far itemsamt ##this list itemsamtin ##a number inputted user itemsamtin2 ##i added variable in attempt extract number , change float if itemsin == 1: itemsamt[0] itemsamtin2 = itemsamt itemsamtin = itemsamtin + itemsamtin2 itemsamt.insert(0,itemsamtin) itemcost = .89 * itemsamtin cost.insert(0,itemcost) totalcost = totalcost + itemcost with line itemsamtin2 = itemsamt you declared itemsamtin2 identical copy of itemsamt. itemsamtin2 becomes list itemsamt is. if tim castelijns right presumption itemsamt[0] meant itemsamt = itemsamt[0] meant itemsamtin2 = itemsamt itemsamtin2 = itemsamt[0]

caching - C# HttpWebRequest second POST request -

i'm having problems second httpwebrequest (post) @ same post url. this how program works now, , except 1 thing. it's logging in website want (a game website) it's doing request @ marketplace of game, grab sourcecode streamreader , put variable type of string, , using regex find 2 different tokens (reloadtoken & rtvt), different @ every pageload , need posted. it's doing post request @ post-url of 'marketplace', result: bid accepted , want. but, needs done every hour 1 time. however, when next hour appears it's sending post request again, time it's not accepted. my first guess caching problem or (maybe it's posting wrong reloadtoken , rtvt?), or problem cookies maybe? i tried deleting cookies after bids , let relog , repost bid again, did not resolve problem. is there forgot do, should let post request work @ same url different data (reloadtoken & rtvt).

c++ - Incorporate setText and setNum into a label in Qt? -

i have few simple lines of code of slot horizontal slider: void newwindow::on_horizontalslider_valuechanged(int value) { ui->label->setnum(value); } now, instead of label displaying number (such "11" or "42"), how make display "value: 11"? i think have incorporate settext too, although don't know how that. there's simple solution haven't found yet. help? use qstring::number convert int qstring : ui->label->settext(qstring("value: ") + qstring::number(value));

git - How do i successfully use the Maven release plug-in with GitHub (or GitHub enterprise) when using a CI tool like Hudson/Jenkins -

how use maven release plug-in github (or github enterprise) when using ci tool hudson/jenkins problems encountered are maven not commit if pom.xml in sub folder rather top level. due subsequent builds fail tag name exists. in spite of setting public key authentication between source server runs ci job, git push fails 1 of following errors public key authentication failed unknown service git there multiple things need correct work. for sub-folder commit of pom.xml work, bug resolved in maven release plug-in 2.5.1. latest dependencies. below section shows pom.xml <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-release-plugin</artifactid> <version>2.5.1</version> <dependencies> <dependency> <groupid>org.apache.maven.scm</groupid> <artifactid>maven-scm-provider-gitexe</artifactid> <version>1.9.2&l

javascript - What HTML5 images events are available to the developer -

i have created html5 web app. i use image control. when image src assigned set local variable =1 when image has finished loading set 0. if variable = 0 , there image available server repeat process. if img.onerror raised set local variable 0 i have noticed if mobile loses internet connection , gets local variable 'stuck' on 1 , img.src never updated. not happen time though. i guessing neither img.onload or img.onerror has been raised. question there other events img control raises can put handler in for? the code: my js function notified signalr image available on server. if (imageisloaded1.status = 0) { var d = new date(); var n = d.gettime(); imageisloaded1.status = 1; staticimgarray.src = './newframe.ashx?a=' + n } staticimgarray.onload = function () { imageisloaded1.status = 0; }; staticimgarray.onerror = function () { imageisloaded1.status = 0; }; according official html5 specification , here idl de

api - Posting data as multipart/form via perl -

i perl newbie , doing rest api calls via perl. send api requests , examine via online http request inspector requestbin i did googling , able perform successful posts if content type 'application/json' here code use rest::client; use mime::base64; $email_id = 'someemail@email.com'; $email_pass = 'password'; $client = rest::client->new(); $client->sethost("http://requestb.in"); $client->addheader('content-type', 'application/json'); $client->addheader('charset', 'utf-8'); $client->addheader("authorization", "basic ".encode_base64("$email_id:$email_pass")); $req=" { \"new_post\":{ \"description\":\"some details on issue ...\", \"subject\":\"custom email\", \"email\":\"someone\@mailinator.com\", } }"; $response = $client->post("/pq0x1rpq",$req); pri

angularjs model doesnt get updated on select change -

i trying integrate angularjs , jquery chosen plugin, works fine when changed model doesnt updated can 1 tell me how go doing this, there video on youtube explains same dont have access youtube, highly appreciated this html code: <select id="categories" data-placeholder="select categories" chosen="categories" ng-model="categoriesselected" multiple="" ng-options="category.name category in categories"></select> <div ng-repeat="category in categoriesselected">{{category.name}}</div> this angular code: app.directive('chosen', function() { return { restrict : 'a', link : function(scope, element, attr) { console.log(attr); $("#" + attr.id).chosen(); scope.$watch(attr.chosen, function(oldval, newval) { $("#" + attr.id).trigger('chosen:updated')

c++ - How to initialise a matrix only when calling a function? -

i'm wondering if can this: create matrix , initialise size when calling function: #ifndef occupancy_grid_h #define occupancy_grid_h #include <math.h> class occupancygrid{ public: void update_cell_value(double x, double y, double status) { matrix[x_origin+x][y_origin+y]=status; } void initialize_map(){ grid_size=100; x_origin=grid_size/2; y_origin=grid_size/2; } private: int grid_size; int x_origin; int y_origin; int const map[grid_size][grid_size] = {-1}; }; #endif is there better way this? thank you use std::vector<std::vector<t>> . ideally initialise in constructor if must initialize later in loop. example: class occupancygrid { public: void initialize_matrix(unsigned size){ matrix.resize(size); for(auto& v : matrix) v.resize(size); } private: std::vector<std::vector<double>> matrix; }; or boost.multiarray .

java - Netbeans exception class not found for javax.swing.JOptionPane -

i'm pretty fresh in java , netbeans platform programming, , have strange issue on 1 of examples 10 netbeans api's (file system). i'm using ubuntu 14.10, java jdk 8, netbeans 8.0.1 i want display data in swing message box after click on menu element. imports fine, dep libs fine , compiles fine. when click on superb menu item have exception: java.lang.classnotfoundexception: javax.swing.joptionpane not found org.netbeans.word.module.fsdemo [42] @ org.apache.felix.framework.bundlewiringimpl.findclassorresourcebydelegation(bundlewiringimpl.java:1532) @ org.apache.felix.framework.bundlewiringimpl.access$400(bundlewiringimpl.java:75) @ org.apache.felix.framework.bundlewiringimpl$bundleclassloader.loadclass(bundlewiringimpl.java:1955) caused: java.lang.classnotfoundexception: *** class 'javax.swing.joptionpane' not found because bundle org.netbeans.word.module.fsdemo [42] not import 'javax.swing' though bundle org.apache.felix.framework [0] ex

Creating a new column in R that looks at the data from two previous columns and assigns a Factor level? -

i have data set looks @ 2 parasites of snails want create new column states whether snails have no parasites "none", type 1 "type1",type 2 "type2" or both parasites "dual". block weight parasite1 parasite2 1 1 1.23 1 1 2 1 3.14 1 1 3 1 2.55 1 0 4 1 2.67 0 1 5 1 3.36 0 1 6 1 3.16 0 0 7 1 3.41 0 1 8 1 2.47 0 1 9 1 1.56 0 1 10 1 2.66 1 1 i have thought of using if or if else can't seem work? you few if else statements, easier think dat <- read.table(header = true, text="row block weight parasite1 parasite2 1 1 1.23 1 1 2 1 3.14 1 1 3

ios - XCode Source Control error -

i'm new source control. using xcode embedded source control project since start of it. , says *** please tell me are. run git config --global user.email "you@example.com" git config --global user.name "your name" set account's default identity. omit --global set identity in repository. fatal: unable auto-detect email address (got 'nkorotkov@nikolays-mini.(none)') and file unversioned next file try commit. seems reason lost name , email. if understand correctly have run 2 commands in terminal re-enter info, i'm afraid if won't equal previous info commi history messed up. how know username used before? update answering comment here's contents of .gitconfig file [filter "media"] clean = git media clean %f smudge = git media smudge %f required = true [user] name = nkorotkov

rcp - Loading resources in a plug-in works in eclipse but not for maven -

i trying load resources platform url approach in e4 rcp application. works fine application plug-in. have got second plug-in extends application via fragments . in plug-in approach platform:/plugin/<name>/<path> does not work. if start project eclipse though, resources can loaded. doing wrong? the build.properties content of plug-in follows: source.. = src bin.includes = meta-inf/,\ .,\ plugin.xml,\ fragment.e4xmi,\ res/ the problem was: maven build case sensitive file names, while eclipse not. new url("platform:/plugin/name/res/myfile.txt") new url("platform:/plugin/name/res/myfile.txt") in eclipse, both versions working; maven build, second version. seems quite strange me. great if explain this.

ios - Passing data back from a modal view in WatchKit -

when modally presenting, or pushing, interface controller can specify context parameter pass data new controller follows. // push [self pushcontrollerwithname:@"mycontroller" context:[nsdictionary dictionarywithobjectsandkeys:someobject, @"somekey", ..., nil]]; // modal [self presentcontrollerwithname:@"mycontroller" context:[nsdictionary dictionarywithobjectsandkeys:someobject, @"somekey", ..., nil]]; my question is, how can reverse? say present controller modally user pick item list , return main controller, how can item has been picked? i wrote full example uses delegation in watchkit, passing delegate instance in context, , calling delegate function modal : here full project example on github here principale classes of example : interfacecontroller.swift this main controller, there label , button on view. when press button, presentitemchooser called , present modalview (modalinterfacecontroller). pass instance of

Android SurfaceView Preview Blurry -

i have quick question. i'm using android's surfaceview take picture , save it. however, preview size , picture quality both terrible; in, blurry. there's no sharpness picture quality @ all. here's initialize surfaceview: camera.setdisplayorientation(90); parameters parameters = camera.getparameters(); parameters.setwhitebalance(camera.parameters.white_balance_auto); parameters.setexposurecompensation(0); parameters.setpictureformat(imageformat.jpeg); parameters.setjpegquality(100); camera.size picsize = getoptimalpreviewsize(parameters.getsupportedpreviewsizes(), getresources().getdisplaymetrics().widthpixels, getresources().getdisplaymetrics().heightpixels); parameters.setpicturesize(picsize.width, picsize.height); parameter

java - Program won't print out the intersection or difference! Any suggestions? -

import java.util.scanner; public class setpractice { public static scanner kbd; public static final int maxsize = 20; public static void main(string[] args) { kbd = new scanner(system.in); int[] seta = new int[maxsize]; int[] setb = new int[maxsize]; int[] intersect = new int[maxsize]; int[] difference = new int[maxsize]; int sizea, sizeb, intersize, diffsize; system.out.print("how many numbers in 1st set: "); sizea = kbd.nextint(); while (sizea > maxsize) { system.out .print("error: set size large. re-enter set size: "); sizea = kbd.nextint(); } system.out.println("enter list of integers 1st set: "); getdata(seta, sizea); sort(seta, sizea); system.out.println("the ascending order 1st is:"); print(seta, sizea); system.out.print("how many numbers in