Posts

Showing posts from May, 2012

php - Get selected text from combox to a variable -

i want select school year combobox , use search classes letter year selected. need put selected text variable. $yeardb = "select distinct `year` `class`"; $do_year = mysqli_query($connectdb, $yeardb); $num_year = mysqli_num_rows($do_year); year: <form method="post" > <select id="yearcb" name="year" onchange="document.getelementbyid('selected_text').value=this.options[this.selectedindex].text"> <?php ($i=0; $i<$num_year; $i++) { $yr = mysqli_fetch_array($do_year); echo'<option value="'.$i.'">'.$yr ['year'].'</option>'; } ?> </select> <input type="hidden" name="selected_text" id="selected_text" /> </form> <?php if(isset

c# - How to keep the checkbox inside gridview checked based on certain condition? -

i have gridview on web , checkbox inside template field. having field in database holds integer value 0 or 1. 0 enable , 1 disable. when check checkbox inserts 1 particular field in database , vice-versa. want when open page, rows value 1 in table should remain checked , rows value 0 in table should remain unchecked.i have tried doing this- aspx page- <asp:gridview id="gridmain" runat="server" width="1000px" autogeneratecolumns="false" onrowdatabound="gridmain_rowdatabound"> <columns> <asp:templatefield headertext="student name"> <itemtemplate> <asp:label id="lblname" runat="server" text='<%# eval("name") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="enable/disable">

android - assign arraylist value to textview -

i'm trying set value arraylist textview arraylist<integer> arraylistpage1, arraylistpage2, arraylistpage3, arraylistpage4, arraylistpage5; arraylistpage1 = new arraylist<integer>(rangemode); arraylistpage2 = new arraylist<integer>(rangemode); arraylistpage3 = new arraylist<integer>(rangemode); arraylistpage4 = new arraylist<integer>(rangemode); arraylistpage5 = new arraylist<integer>(rangemode); totalcardinpage = new int[totalpage+1]; for(int j=1;j<=totalpage;j++){ int x=0; for(int i=1;i<=rangemode;i++){ if(binarytable[i][j]==1){ //maka ada di page j cardinpage[j][x]=i; //array buat card di page 1 if (j==1){ arraylistpage1.add(i); }else if(j==2){ arraylistpage2.add(i); }else if(j==3){ arraylistpage3.a

fonts - Build asset folder empty : android Studio, using Gradle -

i have created simple app in android studio, have placed font under src/main/assets/fonts/fontname.ttf when running build/clean etc. asset folder in build stays empty. (build/exploded-aar/com.android.support/appcompat-v7/19.1.0/assets) the application runs, no instances of file found on device.

php - wordpress - is it possible to add one post with multiple custom post type -

i have create module admin admin can manage post. suppose have create 3 post types new added post type entertainment post type featured post type when user add post post come can add "new added post type" or "entertainment post type", show in admin module respective post type module manage admin. so main issue if admin want show post in "featured post type" admin can this. as per concern admin can switch post "featured post type". , post remove "old post type". so main issue want show post in both post type in front end front end users end module admin user. this fact single can not 2 types because in database can store single value this. but according case don't think difficult task. have problem of end unable show post under 2 types. not need create different post types each. just create category , add post in category 1) category 1 2) category 2 3) category 3 4) category 4 you can create multipl

php - How to download directly from one website to another -

i have piece of php code: <?php $image_cdn = "http://ddragon.leagueoflegends.com/cdn/4.2.6/img/champion/"; $championsjson = "http://ddragon.leagueoflegends.com/cdn/4.2.6/data/en_gb/champion.json"; $ch = curl_init();` $timeout = 0; curl_setopt ($ch, curlopt_url, $championsjson); curl_setopt ($ch, curlopt_connecttimeout, $timeout); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_binarytransfer, 1); $json = curl_exec($ch); curl_close($ch); $json_array = json_decode($json, true); $champions = $json_array["data"]; foreach ($champions $championdata) { $image_url = $image_cdn.$championdata["image"]["full"]; $image = file_get_contents($image_url); file_put_contents("imgfolder/".$championdata["image"]["full"], $image); } ?> so idea of code decode json , download images following website: http://gameinfo.na.leagueoflegends.com/en/game-info/champions/ the pictu

Read and Display Input Using 2D array Java -

i totally new in java 2d array. , trying project a) ask student number b) ask name c) ask exam marks d) display of results. thanks , appreciated if kind enough provide me solution. thanks. i won't directly give code because not here assignment. however, can give hints. the choice of 2d array might not right option you, because suspect you're gonna use way: 1 dimension indexing students, 2nd dimension indexing properties of student. a more java-like approach (or oop approach) create objects representing students, , read 1d array of student objects instead.

java - EBNF to JavaCC lexer -

how convert ::= [a-za-z] javacc? what have done: token : { < letter : (["a"-"z"])> } but don't know how smaller letter parts like this: token : { < letter : (["a"-"z", "a"-"z"])> } reference : a character list describes set of characters. legal match character list character in set. character list list of character descriptors separated commas within square brackets. each character descriptor describes single character or range of characters (see character descriptor below), , added set of characters of character list. if character list prefixed "~" symbol, set of characters represents unicode character not in specified set. note rule: token : { < letter : (["a"-"z", "a"-"z"])> } is equivalent to: token : { < letter : ["a"-"z", "a"-"z"]> } which both match single

ios - iPhone retina 4-inch Simulator with Storyboard set to 3.5 inch -

Image
i'm testing application if run " " , storyboard set 3,5 inch result the following. why? this viewcontroller uitableview inside. tha view controller background color blue. what matter? setting storaybaord 3.5 simulation. might change autolayout in process. if want quick solution try doing following. select viewcontroller in storyboard and, tick both options "under top bars" , "under bottm bars"

android - Scringo - Managing our own users -

i trying implement group chat within our application. have started scringo. able use exisiting example projects open default chat interface , signup inside scringo app. not want users sign inside chat. i have separate database of users login. how integrate myuser info scringouser classes ? relevant details can 1 hour of google search/scringo docs search this.. http://www.scringo.com/docs/api/android/com/scringo/scringogetuserlistener.html according below link scringo docs, seems allowing it. find no information on apis related registering our users scringo user database. http://www.scringo.com/docs/android-guides/popular/setup-a-chat-client/ can me in ? yes.it possible integrate scringo chat interface manage our own users . allow users signup application , onsuccess programatically signup user scringo using thier api. on successfull registration of user @ scringo, retrieve scringo user id , store in db. thats it. play scringo id. link follow: scringo api doc

.htaccess - Trailing slash removal opening full directory -

i'm trying remove trailing slash of urls. whatever htaccess script lines try, redirects seems full server directory. example.com/xyz/ weirdly redirects example.com/customers/b/7/3/example.com/httpd.www/xyz – not found. basically, i'm not using subdirectories getting data out of database according what's last string after last slash. "not found" error ok, because there isn't existing folder. i'm new htaccess, trying out whatever lines found. rewrite opens index.php , not folder (which works fine without trailing slash, engine on): rewriterule ^([a-za-z0-9_-]+)$ index.php?$1 rewriterule ^([a-za-z0-9_-]+)/$ index.php?$1 i failed using remove slash: rewriterule ^(.+)/$ /$1 [r=301,l] so i'm trying is: open url index.php. example example.com/xy doesn't redirect show/open index.php (i think achieved above 2 lines) while doing so, i'm trying remove trailing slash e.g. example.com/xy/ , example.com/xy , example.com/xy/ both sh

php - $_POST from checkbox with the same name and different values -

this question has answer here: getting multiple checkboxes names/id's php 4 answers i have sql database has table (results) gonna save of results of survey. one of questions checkbox (multiple answer), made code should gather results of checkbox questions , put values database. but, something's missing, overwrites last value in array there easy solution cannot see. clarify, want store values of 1 checkbox question if user checks everything. html form <input type="checkbox" name="checkbox1" value="this first value"> <input type="checkbox" name="checkbox1" value="this second value"> <input type="checkbox" name="checkbox1" value="this third value"> php script for($i=1;$i<101;$i++) { if(isset($_post['checkbox'.$i])) { $q[$

smoothing graph line in Matlab -

Image
i have following graph , make more pleasing eyes smoothing graph. possible ? tempyr = 1880:1:2014; temperature = temp(1:2, 1:135); tempval = {'annual mean','5 year mean'} th = zeros(size(tempval)); hold on th = plot( tempyr', temperature', '-o', 'marker', '.'); xlabel( 'year', 'fontsize', 24); ylabel( 'temperature anomaly (degree cel)', 'fontsize', 24 ); legend(th, tempval) grid on ideal graph. try th = plot( tempyr', temperature', '-o', 'marker', '.','linesmoothing','on'); and have here , export_fig reference might prove useful.

HashMap java.util.ConcurrentModificationException -

i have following code: public list<string> processmap(map<string, string> amap) { cloner cloner = new cloner(); map<string, string> tempmap = cloner.deepclone(amap); while(!tempmap.isempty()) { iterator<entry<string, string>> iterator = tempmap.entryset().iterator(); while(iterator.hasnext()) { entry<string, string> entry = iterator.next(); // !!! } } return null; } to deep copy map use library: cloner i marked line unfortunately ava.util.concurrentmodificationexception '!!!' can please tell me why exception? the complete code: cloner cloner = new cloner(); map<string, freebasetype> tempfreebasetypes = new hashmap<string, freebasetype>(); map<string, freebasetype> freebasetypescopy = cloner.deepclone(freebasetypes); while(!freebasetypescopy.isempty()) { iterator<entry<string, freebasetype>> iterator = freebasety

javascript - Bootstrap-select plugin: how to avoid flickering -

the bootsrap-select plugin amazing ( http://silviomoreto.github.io/bootstrap-select/ ). provides extremely easy way of creating gorgeous select menus in bootstrap. 1 problem i've encountered it, however, "flickering" on page load. mean straight forward: the page loads original html select element (which of course looks crap) the bootstrap-select plugin js runs at noticeable time after page loads original html select element converted nice bootstrap-select element js in step (2). so, user first sees html select element , sees switch pretty bootstrap-select item, "flickering". has found solution problem? to show blank until bootstrap-select loaded, add css. select { visibility: hidden; }

objective c - Change UIImageview shape to match shape -

i have had around forums , cannot find answer question makes sense me..so hoping can shed light on this. i have cloud , object , when these make contact game on (really basic explanation of game) - problem have cloud, being in shape of..well..a cloud, , image view being rectangle means other object makes contact , runs method game on before, visually, has made contact. please me! :-)

multithreading - Android java.util.concurrent.Executors newSingleThreadScheduledExecutor example -

i having problem android java.util.concurrent.executors. i trying use newsinglethreadscheduledexecutor run runnable every x seconds. saw executor.scheduleatfixedrate(mytask, 0, 50, timeunit.milliseconds); doesn't exists in android. the android documentation link , not give clue how should use newsinglethreadscheduledexecutor; could give me example how should use run runnable every x seconds? know can use handler, wondering how can use singlethreadscheduledexecutor same. thanks in advance. you can example here: http://www.java2s.com/code/javaapi/java.util.concurrent/executorsnewsinglethreadscheduledexecutor.htm actually executors comes java 7 .

java - Looping through image pixels is crashing my program -

i started work little image processing software. need set image black & white , loop through pixels , generate report of counter, coordinates , color of each pixel (#,x,y,color). it works fine tiny images create test, when use real picture, takes several minutes or crash software. code inside loop seems simple crashing. any tip on how can improve it? in advance! void processimage(bufferedimage image) { exportstr = "#,x,y,color"+ newline; color c = new color(0); int imgw = image.getwidth(); int imgh = image.getheight(); matrix = new int[imgw][imgh]; int currentpx = 1; for(int x=0; x < imgw; x++) { for(int y=0; y < imgh; y++) { c = new color(image.getrgb(x, y)); if(c.equals(color.white)) { matrix[x][y] = 1; } string color = matrix[x][y]==1 ?

jquery - Creating a full width slider with custom icons as pagination -

i attempting create full width jquery slider custom icons pagination. image slide vertically when each icon clicked , icon remain highlighted sections title replacing icon (active link). best way go doing this? have not written code yet please dont ask me post any. if kind guide me through maybe first slide, ill able achieve rest. thanks in advance! iosslider pretty good, , worth $15 license fee. should able achieve custom icons regardless of plugin use - css selectors set background image each element index.

Nonsense prediction using package segmented in R -

i first fitted poisson glm in r follows: > y<-c(13,21,12,11,16,9,7,5,8,8) > x<-c(74,81,80,79,89,96,69,88,53,72) > age<-c(50.45194,54.89382,46.52569,44.84934,53.25541,60.16029,50.33870, + 51.44643,38.20279,59.76469) > dat=data.frame(y=y,off.set.term=log(x),age=age) > fit.1=glm(y~age+offset(off.set.term),data=dat,family=poisson) next tried predictions of response (on log scale) new dataset using predict function. note set offset term zero. > newdat=data.frame(age=c(52.09374,50.89329,50.61472,39.13358,44.79453),off.set.term=rep(0,5)) > predict(fit.1,newdata =newdat,type="link") 1 2 3 4 5 -1.964381 -1.956234 -1.954343 -1.876416 -1.914839 next tried package segmented (version 0.3-0.0) in r , fitted segmented glm follows. (the latest version of segmented package (i.e. 0.3-1.0) not seem support offset term when using predict function.) > library(segmented) > fit.2=segmented(fit.1,seg.z=~age

javascript - Canvas snippets for sublime or atom text editor -

how can convert textmate snippets sublime or atom.. https://github.com/johnhunter/javascriptcanvas.tmbundle and please best text editor developing canvas application support autocomplete , live preview. i got :) i tried make package atom , works fine. also think orginal snippets i've shared above works fine in sublime, i've tried it. https://atom.io/packages/canvas-snippets if found more packages can within developing canvas apps please post here :) here. thanks

java - Android - GET Request using Https failing - not sure why -

good afternoon, i have been making http , post requests various websites using android's httpurlconnection object few weeks , have had no problems in doing until now. i have been required make request server using https rather http. i presumed needed change object in use httpsurlconnection object instead in order access page. i can verify able access page both desktop , mobile browsers. output of page text - list of items in plain text format (generated php on server). but when try , download information using android app io exception error @ point specified below (see code block below). the code snippet below run in different thread. manages connect , set connection parameters, upon trying open input stream fails. unfortunately error message doesn't mean lot me. contains url of website no other information. my thoughts either: a) i'm missing when connecting using https - tips here great. b) website doing different other http based websites i'v

Multilevel category showing for select options in rails -

currently using grouped_options_for_select show category in rails project. code below collection = ["north america",[["united states",["inner"]],["canada",["inner"]]]] <%= select_tag(::id_methods, grouped_options_for_select(collection, selected_key = " ", prompt = nil)) %> this output below north america united states inner canada inner but want output below north america united sates inner canada inner how can this? try this:- collection = ["north america",["united states",["inner"]],["canada",["inner"]]] <%= select_tag(:id_methods, grouped_options_for_select(collection, selected_key = " ", prompt = nil)) %>

vbscript - Classic ASP - looping through folder with large amount of images -

i maintaining site uses html editor image upload feature. when click upload opens popup lists path every image in folder. there more 7000 images in folder. the code quite messy. uses scripting.filesystemobject array of files , loops using each statement.a response.write used display each file's info , reason issue occurring if there's more 4015 images in folder. no error occurring such seems function writing out files fails silently , page stops rendering. i confused why works when there's less 4015 files. memory issue ? expecting receive error of sort. thanks info. below response.write being used each file response.write "<tr style='background:" & scolorresult & "'>" & vbcrlf & _ "<td><img src='images/"&sicon&"'></td>" & vbcrlf & _ "<td valign=top width=100% ><u id=""idfile"&nindex

php - Xampp Virtual Host for sub directory -

question i map www.mydomain.com/some/url to c:/xampp/htdocs/some/dir what i've got xampp wordpress htaccess <ifmodule mod_rewrite.c> rewriteengine on rewritebase /some/path/ rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /some/path/index.php [l] </ifmodule> hosts file 127.0.0.1 www.mydomain.com httpd-vhosts.conf (included in httpd.conf ) <virtualhost *:80> documentroot "c:/xampp/htdocs/somedir/" servername mydomain.com/some/path </virtualhost> additional info (httpd.conf) documentroot "c:/xampp/htdocs" <directory "c:/xampp/htdocs"> options indexes followsymlinks includes execcgi allowoverride require granted </directory> current outcome 500 internal server error error log shows request exceeded limit of 10 internal redirects due probable configuration error. add alias httpd.co

html - AngularJS - ng-repeat inside of ng-grids cellTemplate -

given following data set: { "url": "www", "words": [ { "name": "fish", "count": 1 }, { "name": "pig", "count": 60 } ] }, { "url": "www", "words": [ { "name": "zebra", "count": 0 }, { "name": "cat", "count": 12 } ] }, { "url": "www", "words": [ { "name": "dog", "count": 0 }, { "name": "antilope", "count": 2 } ] } i'd create grid like: url words:count --------|-------------- | | fish:1 | | www | pig:60 | etc...

ios - CCSprites and CCButton in wrong spot in iPad Simulator -

Image
i trying achieve this: here code: cgsize size = [uiscreen mainscreen].bounds.size; [self resizesprite:background towidth:size.width toheight:size.height]; nslog(@"screen size: %@",nsstringfromcgsize(size)); background.position = cgpointmake(0 + background.contentsize.width ,size.height - background.contentsize.height); playbutton.position = cgpointmake(size.width/2, size.height/2); nslog(@"button position: %@",nsstringfromcgpoint(playbutton.position)); nslog(@"background position: %@",nsstringfromcgpoint(background.position)); and here resizesprite method: -(void)resizesprite:(ccsprite*)sprite towidth:(float)width toheight:(float)height { sprite.scalex = width / sprite.contentsize.width; sprite.scaley = height / sprite.contentsize.height; } when run in iphone 4 inch simulator looks perfect when run on ipad simulator looks this: if use: cgsize size = [[ccdirector shareddirector]viewsize]; it looks on ipad: right so

What is an efficient way to get column from multi-dimensional array in C? -

i have 2 structs: array2d (multidimensional) , array (one-dimensional). column type array2d , copy type array. although code works below, , recognize poor way of getting column array, i'm curious optimizations there might avoid o(n2) algorithm. efficient way column array in c? bool arr2_getcolumn(array2d *arr, const int column_index, array *returnedarray) { int x, y; int = 0; /* check valid array. */ if (arr->blnisinit != true) return false; /* initialize array column's height. */ if (!arr_init(returnedarray, arr->height)) return false; /* copy on column. */ (y = 0; y < arr->height; y++) { (x = 0; x <= column_index; x++) { if (x == column_index) { returnedarray->array[i] = arr->array[y * arr->width + x]; i++; } } } /* set new size. */ returnedarray->size = arr->height; retur

objective c - iOS Dropbox SDK: Error Domain=NSURLErrorDomain Code=-1005 -

my code, in i'm uploading file dropbox, used work properly. make connection , had no problems whatsoever, seems it's not able make connection anymore , i'm getting "error domain=nsurlerrordomain code=-1005 "the operation couldn’t completed." this line error seems occurring: [self.restclient uploadfile:filename topath:destdir withparentrev:nil frompath:localpath]; i've been using example given on dropbox core api website main reference, stuff comes directly example, , therefore not sure problem be. edit: i'm getting following: "file upload failed error: error domain=dropbox.com code=401"

jquery - Add Element/Paragraph after html BR? -

evening all! i'm having issues styling out few pages on site. problem i'm having information that's being pulled , displayed on page has no real styling included, contain <brs> which end rendering content quite ugly! i'm looking see if there's way can insert paragraph tag, after br element, before text. , add closing paragraph tag after text, before br tag underneath. - putting text that's between breaks paragraphs allow further styling. i've dropped example on on: http://jsfiddle.net/fish_r/9efc8/ - here, i've started experimenting $( "#property-info p br" ).before( "<p>" ); but adds punch of paragraph tags around br's rather around text. i don't have control of way information output onto page manually. please try below code part. can set p tag. $( "#property-info p br" ).each(function( index ) { //console.log( index + ": " + $( ).text() ); $(this).before(

mysql - Counting how many times each unique element appeared in `select` query -

Image
i have mysql database million of records, table indexed. below table structure. i ran below code in table. select `iwebs` `wordstable` `iwebs` 'a1' or `iwebs` 'a2' or `iwebs` 'a3' or `iwebs` 'a4' or `iwebs` 'a5' or `iwebs` 'a6' or `iwebs` 'a7' or `iwebs` 'a8' or `iwebs` 'a9' or `iwebs` 'a10' now code generates below output (small part of output displayed). however, not need. need key-value pair displays how many times each individual element appeared in result. like [a1,400] [a2,100] [a3,5] [a5,500] ........ in above example, first item in each bracket means individual element appeared in select query , second item means number of times appeared. in other words, means "a1 appeared 400 times in select query", "a2 appeared 100 times in select query", "a3 appeared 5 times in select query" , "a5 appeared 500 times in select query" , on. how can i

excel - Infinite For...Next loop: how do I fix it? -

i'm trying delete rows cell values non equivalent 1 of values array ar(). when put logical operator not loop goes infinite reason (excel freezes). in opposite works flawlessly, in case if want delete rows containing values array. the problem on line: if not .cells(i, 10).value = ar(j) then my code: sub tims() dim lastrow long, lr long dim long, j long dim t integer dim ar() string worksheets("start").activate t = count("a", range("a3:a14")) lr = range("i3:i10").end(xldown).row worksheets("master").activate sheets("master").range("a100:a" & 100 + lr - 3).value = sheets("start").range("i3:i" & lr).value worksheets("master") j = 1 lr - 2 redim preserve ar(j) ar(j) = cells(99 + j, 1) next j end worksheets("master") lastrow = .cells(.rows.count, "b").e

Python Using methods from other modules -

i have 2 modules called dfs , graph. in graph module, have class graph , method called readgraph. in dfs module, have method calls on readgraph following error message when type: dfs.processgraph(testcase.txt,verbose=true) error message: nameerror: name 'testcase' not defined could explain how fix this? thanks. from dfs.py module: import sys graph import * class dfs( object ): def processgraph(file_name, verbose): g=readgraph(file_name) from graph.py module: class graph( object ): def readgraph( file_name ): remove class declaration graph.py. when import file top level objects. in case it's graph class itself, not methods. also need pass string 'testcase.txt' not testcase.txt .

python - How to bind volumes in docker-py? -

i think used work few months ago. regular commandline docker: >> docker run --name 'mycontainer' -d -v '/new' ubuntu /bin/bash -c 'touch /new/hello.txt' >> docker run --volumes-from mycontainer ubuntu /bin/bash -c 'ls new' >> hello.txt works expected cannot work in docker-py: from docker import client #docker-py import time docker = client(base_url='unix://var/run/docker.sock') response1 = docker.create_container('ubuntu', detach=true, volumes=['/new'], command="/bin/bash -c 'touch /new/hello.txt'", name='mycontainer2') docker.start(response1['id']) time.sleep(1) response = docker.create_container('ubuntu', command="/bin/bash -c 'ls new'", volumes_from='mycontainer2') docker.start(response['id']) time.sleep(1) print(docker.logs(response['id'])) ..always tells me new doesn't exist. how volumes-from s

How to write a JMeter test for Java Request -

i need load testing on in memory databases. i want use jmeter , under impression need write class implements javasamplerclient. i have no idea start. jmeter website has offer helps me little. first time doing , have been lost days! so maybe can explaining basics of how class should set out? packages might need import? because whenever try tell implement javasamplerclient error. also maybe brief summary on how works? method run many times specified in jmeter? or happening here? to use java request in jmeter must create java class inhertit javasamler client. that,you myst dowlsoad 2 jar files , add them classpath if working eclipse. 2 jar files apachejmeter_core.jar , apachejmeter_java.jar class that: import org.apache.jmeter.config.arguments; import org.apache.jmeter.protocol.java.sampler.abstractjavasamplerclient; import org.apache.jmeter.protocol.java.sampler.javasamplercontext; import org.apache.jmeter.samplers.sampleresult; public class javarequest extends abs

javascript - Jquery show div on checkbox -

hello want display div when checkbox checked. thing have multiple selects , want display form until none selected. code not working should because when deselect checkbox div dissapears , should dissapear if none selected. here js $('.checkbox').click(function() { if( $(this).is(':checked')) { $("#formular").show(); } else { $("#formular").hide(); } }); also jsfiddle http://jsfiddle.net/byuak/ try var $checks = $('.checkbox').click(function () { $("#formular").toggle($checks.filter(':checked').length>0); }); demo: fiddle

qt - no such file or directory -

i finishing migrating project qt 4.x 5, .pro file giving me lot of errors: c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lhdp c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -l../../qwt/qwt-5.2.0/lib/debug/qwt5 c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lqenc c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lzlibwapi c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lqextserialport c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lqxmpp c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -ljson_lib c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lserialport1 when comment lines containing -lwhatever same errors other lines below those, @ moc_dir += ./generatedfiles/release objects_dir += release ui_dir +=

c# - insert sql commands by textbox -

i created win forms, , wanna insert sql commands , data database. if put query directly code sql commands, ok, if put query textbox have lot of bugs like: $exception {"could not find stored procedure 'select * uczniowie'."} system.exception {system.data.sqlclient.sqlexception } {mateuszlab4.connectdb} mateuszlab4.connectdb question "\"select * uczniowie\"" string datatable {} system.data.datatable sqldatareader null system.data.sqlclient.sqldatareader sqlcommand {system.data.sqlclient.sqlcommand} system.data.sqlclient.sqlcommand here code: private void buttonsearch_click(object sender, eventargs e) { string query = textboxquery.text; connectdb databasewin = new connectdb("(localdb)\\v11.0", "mat"); datagridviewadvanced.datasource = databasewin.datadownload(query); } when put string query sql

magento programmatically add more custom options -

i programmatically create product more 1 custom option. current code bellow last option saved. can help? $options = array( array( 'is_delete' => 0, 'title' => 'first line', 'type' => 'text', 'is_require' => 0, 'sort_order' => 1, ), array( 'is_delete' => 0, 'title' => 'second line', 'type' => 'text', 'is_require' => 0, 'sort_order' => 2, ) ); $product = mage::getmodel('catalog/product')->load($id); $optioninstance = $product->getoptioninstance(); foreach($options $option){ $product->sethasoptions(1); if (isset($option['is_require']) && ($option['is_require'] == 1)) { $product->setrequiredoptions(1); } $optioninstance-&

ios - Memory leaks when loading images to scroller -

i have scrollview in load images net .i memory warnings, assume because doing wrong images loader. trying fix little things, , wanted show code here, , hear maybe there more things can fix rid of warnings. so every time scroller (ipad) has 4/5 images : current page-3->current page+3 . this how load images(every image has blur effect apple's classes) : (should allocated imageview every time? can improve here? ) dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_background, 0), ^ { nsdata *imdata2 = [nsdata datawithcontentsofurl:url]; dispatch_async(dispatch_get_main_queue(), ^ { uiimage *theimage=[uiimage imagewithdata:imdata2 scale:1]; uiimage *lightimage = [theimage applylighteffect]; uiimage *scaledimage =[resizer resizeimagetowidth:[globals sharedglobals].imageswidth withimage:t

php - Is it fine to instantiate models for tables for which model files are not created -

there more 300 tables in our cakephp application. used create model file each of table later started use objects of existing thin models, operating on tables not used or not important implementation of business logic point of view. i work this. $resumes = new profile('','resumes','connectionname'); or $resumes = new profile(20,'resumes','connectionname'); $resumedata = $resume->read(); this works me , rid of creating files remain without code, curious know if break convention or design patterns. you don't need create model files you can instanciate models, whether file exists or not, using class registry: $inst = classregistry::init('resume'); this return instance of appmodel - using table resumes . don't use new modelname it's not normal write new modelname - use of existing means of creating models instead (classregistry::init, $uses, associations).

In SQL Server, like "use <<DatabaseName>>", how to "use <<ServerName>>" Query command -

in sql server, use <<databasename>> , how give use <<servername>> query command? right click | change connection must associated command. isn't it. curious.. when connect sql server, connecting specific server instance. server instance can host number of different databases. use database command allows tell sql server database in instance use. a corresponding use server command not make sense. other server instances not connected or part of instance. when connected server, had provide credentials may or may not valid on other servers, , authentication best practices recommend against preserving credentials throughout session, meaning has no way re-authorize connection different server. what can create linked server, using sp_addlinkedserver procedure. must include server name part of fully-qualified table name each query.

javascript - Left and right arrow keys not registering onkeypress -

i have on key event fires fine , registers space bar when pressed, left , right arrow keys nothing, don't fire. $('html').keypress(function(e) { if(e.which == 32) { event.preventdefault(); app.playpausetoggle() } else if(e.which == 37) { event.preventdefault(); app.changetrack('previous') } else if(e.which == 39) { event.preventdefault(); app.changetrack('next'); } }) i'm key codes fine: http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes i've tried console.log tests under if s , nothing either. .keypress ignores arrow keys, you're going want use .keydown instead.

When debugging in device with ART enabled, android app is slow -

i dont know why week ago when debugging app in android studio, app in device slow, if generate apk or use play (not debug) option works fine.. anyone have idea why? think didnt change in sdk or in app this.. when art enabled, device cannot ensure compiled code matches bytecode instructions. therefore cannot step through instructions , therefore lines. this forces device fallback slow interpreter, possibly doesn't jit-compile. for faster debugging, switch dalvik.

javascript - Getting words separated by " / " with Regex -

i have following fragment of code: html <div class="colors"> <h1>colors:</h1> <div class="recipe"></div> </div> <div class="numbers"> <h1>numbers:</h1> <div class="recipe"></div> </div> <div class="people"> <h1>people:</h1> <div class="recipe"></div> </div> javascript var colors = 'yellow / black / purple', numbers = '5 / 15 / 25', people = 'brad pitt / leonardo dicaprio / anne hathaway'; $('.colors .recipe').html(colors.replace(/(\w+)\/*/g, '<em>$1</em><br>')); $('.numbers .recipe').html(numbers.replace(/(\w+)\/*/g, '<em>$1</em><br>')); $('.people .recipe').html(people.replace(/(\w+)\/*/g, '<em>$1</em><br>')); check out in jsfiddle. i not re

c# - Get DNS TXT record -

i want lookup txt record in c# - in particular want unity3d (so mono 2.1 think, opposed full fledged .net). don't require other fancy dns stuff, , it's app i'd prefer not bloated, i'm preferably looking doesn't require huge library. how can this? there nothing built in in full .net framework txt or other dns record except actual dns resolution. dns class 1 deals dns , provides mapping of ip name , reverse. you need find library or construct request directly. consider checking out existing samples dns resolver article on codeproject starting point.

Delphi 2007, not all installed printers show in printer setup dialog -

i have 2 users tell me standard tprintersetupdialog in our delphi 2007 application not list installed printers. one user installed canon d1300, selected default printer in control panel not show in list in printersetupdialog. another user reported same problem xerox phaser 8560, default printer in control panel. is there know reason happen. john taylor

c# - Multi-touch buttons on Windows Phone 8 -

i using bunch of rectangle shapes in windows phone 8 app , need support multi-touch few of them can tapped @ 1 time. not doing handling on thought multi-touch supported default in windows phone 8 apps. everything written in c# , xaml. when try press 2 rectangles @ same time tap event never gets hit on either of them. thank thoughts on this. xaml of tiles: <rectangle x:name="tile11" horizontalalignment="left" height="103" margin="10,22,0,0" verticalalignment="top" width="103" tap="tileclickhandler" hold="tileholdhandler" mouseleftbuttondown="tile11_mouseleftbuttondown" mouseleftbuttonup="tile11_mouseleftbuttonup"> <rectangle.fill> <imagebrush stretch="fill" imagesource="/assets/tiles/default.png"/> </rectangle.fill> </rectangle> <rectangle x:name=&qu

html - Show submit button as an image -

Image
i'm trying place form button inside table cell displayed image. set input type image, don't want mouse coordinates passed get. this i've tried: html: <form action='php/like.php' method='get'> <input type='submit' id='like' title='like' name='id' value='<?php echo $value[id]; ?>' /> </form> css: #like { background: url('images/star.png') no-repeat; width: 16px; height: 16px; } this result (tested on firefox , chrome): how can image displayed? font-size:0; into class rid of text overlays submit button.

Android: how to get the inputs from layout that was created programmatically? -

i have created row in table layout dynamically event of on click listener, i'm facing hard time getting data elements of row (1 edittext , 3 spinners). 2 solutions might here 1) saving references these views in activity class fields 2) specify id while creating views & use findviewbyid access

matlab - Reversing one y-axis of a plotyy -

my code: figure [ax, h1, h2] = plotyy(x1,y1,x2,y2,'semilogy','semilogy'); now want reverse direction of second y-axis. tried adding: set(h2,'ydir','reverse'); but results in following error: the name 'ydir' not accessible property instance of class 'lineseries'. ydir writeable property of axis, not of graphics object: set(ax(2),'ydir','reverse')

java - JavaFX8 Calendar -

i've seen javafx8 has datepicker built-in. thing need calendar, without textfield. there's way can access calendar view without datepicker or have make own custom control? i've written open source library providing controls based on new date , time api. maybe find useful. can read more here: http://puces-blog.blogspot.ch/2013/12/drombler-commons-date-and-time-controls.html http://puces-blog.blogspot.ch/2013/04/drombler-commons-javafx-controls-for.html

html - Find and separate links in JavaScript string -

i making windows 8 app html + js , have field user can input data, when revisit page set <div> equal input. possible may input url want convert link. every example has read talks enclosing in tag when write text div use "div.innertext" rather "div.innerhtml" in case user wrote incorrect html data causes app crash. is there anyway can fail safe against user entering incorrect html , still have hyperlinks in text? you need escape user data first , replace urls links , use innerhtml property write data element

menu - Java Best way to invoke methods with a given string -

so i'm making custom menu , sub-menu item class handles invoking correct method. using switch statement method name, best way it? i love new set of eyes, have been looking @ way long. thanks! import java.awt.event.mouseevent; import java.awt.event.mouselistener; import javax.swing.jlabel; import com.as.devcenter.util; public class menusubitem extends jlabel implements mouselistener { private static final long serialversionuid = 1l; private string action = ""; public menusubitem(string label, string action, class<?> classname) { addmouselistener(this); this.action = action; settext(label); setname(action); setsize(util.widthoftext(gettext(), util.getdefaultfont()) + 4, 22); } /* * start mouse events */ @override public void mouseclicked(mouseevent e) { util.log("menusubitem clicked"); if (action.equalsignorecase("")) { util.log("no action provided menus

java - fail to marshal nested xml elements -

im trying create xml java class nested element. don't mistake , should change thanks! my main class: string my_xml = "my path..."; //hier path... jaxbcontext context = jaxbcontext.newinstance(masterdatarm.class); marshaller m = context.createmarshaller(); m.setproperty(marshaller.jaxb_formatted_output, boolean.true); master temp = new master(); temp.settransactionstatus("almostok"); m.marshal(temp, new file(my_xml)); m.marshal(temp, system.out); my class marshalled: @xmlaccessortype(xmlaccesstype.field) @xmlrootelement public class master { @xmlelement protected date responsedatetime = new date(); @xmlelement protected transaction transaction; public void setresponsedatetime(date date){ this.responsedatetime = date; } public date getdate(){ return responsedatetime; } public static class transaction{ @xmlelement string status = "ok"; } public void set

Convert two date columns from two different tables into one in sql server -

i need make query in sql server.. have 2 tables table#1 : id -- onedate -- hourswork 1 -- 25/04/2014 -- 5 2 -- 26/04/2014 -- 7 table#2 : id -- adate -- hoursrest 1 -- 25/04/2014 -- 5 i want query result id -- date -- hourswork -- hoursrest 1 -- 25/04/2014 -- 5 -- 5 2 -- 26/04/2014 -- 7 -- 0 as can see need match id , date. select table1.id , table1.onedate , table1.hourswork , isnull(table2.hoursrest, 0) table1 left join table2 on table1.id = table2.id

Collections subtle differences in Java -

why have mention capacity in case of priorityqueue constructor when using comparator priorityqueue , not case other collections use comparator , sort of capacity in constructor not mandatory , compiles fine while in case of priorityqueue if have use comparator have mention capacity else compile time error thrown. class pq { priorityqueue<integer> pq2 = new priorityqueue<integer>(10, new pq.pqsort()); static class pqsort implements comparator<integer> { public int compare(integer one, integer two) { return two.compareto(one); } } } you'd need ask api designers. i guess did not want provide overloaded constructors possible combinations of optional arguments. ones think used, , 1 options (where have provide defaults ones don't care about). other languages solve having optional, named parameters defaults. in java, stuck positional parameters (and api designers choosing provide many

java - Using Future<V> -

in documentation , shows example code future<v> , in gae datastore orm's can see usages pattern, implication of using future on doing datastore put , get or delete methods? common motivation on doing this? the reason future used because database operations done asynchronously, can carry on doing whatever , come check result of database operation. the implications of asynchronous store read value stale, ie put has been sent future operation not complete, or worse, value has been deleted, orm has solved you. you can use future.get block current thread , wait operation complete , check result.

python - Runnig Django project outside virtual enviroment -

i have made api in tastypie django uploads image worked inside django virtual environment. when run outside virtual environment doesn't work. have installed many libraries required image processing , want link work api libraries not imported in virtual environment there solution ???? just install required packages within virtual environment. once activate virtual environment, type: pip install <package name> changing <package name> package want installed.

c# - Push notification to wp8 using javascript (JQuery Request) -

so trying pushing notifications windows 8 application using javascript. so after checking website useful website found. http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202977(v=vs.105).aspx i understood following: 1- need develop app request push notification service uri shared push client service. (the code app needs nothing copy link above) 2- need send notification (raw notification) using push client service (here appears problem :) ) the issue code .net files not familiar with. tried convert code .net html , .js going send ajax request given uri. however give me wired error , unfortunately couldn't find example of sending notification using .js so here original code defines simple form send request uri. difference between , code using jquery ajax request send original code html <%@ page language="c#" autoeventwireup="true" codebehind="sendraw.aspx.cs" inherits="sendraw.sendraw" %> <!