Posts

Showing posts from July, 2011

.htaccess - Htaccess conflict SEO Url friendly -

the code below seems conflict index.php how go allowing index.php? :) > http://www.domain.com/ options -multiviews rewriteengine on rewritebase / rewriterule ^(\w+)/?$ live.php?content=$1 [l,qsa,nc] note: still want rewrite url /$1 all grateful thank solution. if have solution without affecting current structure feel free post below. better add rewritecond avoid rewriting existing files/directories: directoryindex index.php options -multiviews rewriteengine on rewritebase / rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^(\w+)/?$ live.php?content=$1 [l,qsa]

javascript - Script error with loading jQuery in IWebBrowser2 -

Image
the following error shows when load page uses jquery in iwebview. checked if js files have errors, seem fine. clues anyone? vasa, latest 1.x version 1.11.1: https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js you may want try pointing see if upgrade has fixed script error. also, using non-minified version development may give more detail line , character.

java.util.scanner - Java scanner - Using a new line as a delimeter, but not a blank space? -

this question has answer here: java scanner question 3 answers assuming have 2 lines of text this: sam|y|rutgers jane|y|penn state my current scanner report: sam|y|rutgers jane|y|penn state instead of keeping penn state together. is there way can specify delimeter settings include new line, not space? scanner scan = new scanner(...); string val = scan.nextline(); this set delimiter newline.

bluetooth - Will Android Wear receive PutDataRequest if GoogleApiClient returns connected? -

i have wear application , phone application talks each other. phone application pushes data wear. on phone, googleapiclient.isconnected() returning true though bluetooth off. suggests aren't connecting wear google service responsible syncing data. however when connect wear(watch) afterwards data never received watch. there delay in data sync between wear , phone application? have information on this? yes, when reconnected, android wear sync data items between devices. process happens wear apps , bluetooth protocol used relatively low bandwidth, can take while happen on specific app (usually still less minute if - depends on amount of data being synced). make sure app can communicate across data layer when attached 1 another. if using wearablelistenerservice , should able idea delay noting when device reconnects (via onpeerconnected() ) , measure time until ondatachanged() called, although there isn't can besides sync less data.

javascript - Selecting next div jquery -

i trying select .next() div work within carousel. however, seems returning .children() rather .next() html <nav class="slider-navigation"> <div class="left-arrow"></div> <div class="right-arrow"></div> </nav> <div class="slides"> <div class="slide" id="slide1"></div> <div class="slide" id="slide2"></div> <div class="slide" id="slide3"></div> <div class="slide" id="slide4"></div> </div> jquery $(".left-arrow").click(function () { var currentslide = $(this).parent().siblings(".slides").children().next(); // currentslide. }); when console.log(currentslide) in browser returns 4 children of .slides . the same happens for $(".right-arrow").click() i did not want add duplicate code any help? thanks

three.js - ThreeJS pass uv coordinates to RawShaderMaterial? -

i'm trying create shader texture map on scratch. looking @ other materials (shaders) , sources, seems have "uv" attribute passed them. i'm having hard time figuring out uv attribute generated , assigned. set on geometry, material, or both? i'm using default three.geometry objects, three.spheregeometry . assumed have attributes set on them, when inspect meshes scene children don't see attribute key/value set on them. this example of shader generated shadermaterial or other: vertex shader attribute vec2 uv; varying vec2 vuv; void main() { vuv = uv; fragment shader varying vec2 vuv; uniform sampler2d map; void main() { vec4 texel = texture2d( map, vuv ); however, when attempt above, shader (with rawshadermaterial) goes blank , "could not compile." is there magic in 3 sets relationship between shader, object , attributes? i found three.js generate uv coordinate question, again, i'm guessing 3 default object has uv

ruby - vim snippets issue: different results in different filetypes -

Image
i've added new set of snippets .vimrc (i'm using vundle , 2 plugins are: ' https://github.com/msanders/snipmate.vim.git ' (the basic snippet package) , ' https://github.com/kaichen/vim-snipmate-ruby-snippets.git ' (some additional snippets - rspec me). they're setup plugins , installed plugininstall completes no errors. here's strange part: snippets in rspec files (e.g., test_something_spec.rb) not work correctly, yet same snippet works fine plain ol' ruby file (e.g., myscript.rb). the problem positioning of replace 1 character off left in x_spec.rb there's no space between keyword, such def, , method name type. here's example using desc (describe) snippet: here's looks in ruby file right after type "desc{tab}" and here's looks in rspec file @ same place: there's same kind of problem using def snippet. one more thing learned more testing: if _spec.rb file in main spec/ directory, works fine. it's

c++ - Do I need to set my destructor methods when I am using shared pointers? -

i tried finding answer didn't see 1 particular problem. using shared pointers ternary search tree (to used predictive text algorithm) , running problems using shared pointers. i've been away c++ 5 years, , let me tell you, java not learn pointers. i've had relearn pointer material learned in school 5-6 years ago on past couple of days, , have managed destroy code. here of code have: // ternarysearchtree.cc #include "stdafx.h" #include "ternary_search_tree.h" //constructor ternarysearchtree::ternarysearchtree() { num_nodes_ = 0; size_in_memory_ = 0; root_node_ = nullptr; } ternarysearchtree::ternarysearchtree(const ternarysearchtree& other) { num_nodes_ = other.num_nodes_; size_in_memory_ = other.size_in_memory_; ternarysearchtreenode node; node = *other.root_node_; root_node_.reset(&node); } //destructor ternarysearchtree::~ternarysearchtree() { } //operators ternarysearchtree& ternarysearchtree::operator=(con

php - Call jquery alert only when an error occured during submit -

i have small script display error inside div when error occured in form. //php if(empty($date_from) && empty($date_to)) { $error = "no search query"; } elseif(empty($date_from) && !empty($date_to)) { $error = "specify end date search"; } elseif(!empty($date_from) && empty($date_to)) { $error ="specify start date search"; } else { $error ="som error"; } //form <p>date: <input type="text" class="datepicker" name="from_date" id="field1"></p> <p>to</p> <p>date: <input type="text" class="datepicker" name="to_date" id="field2"></p><br /> //script <script> window.settimeout(function() { $("#alert").fadeto(800, 0).slideup(900, function(){ $(this).remove(); }); }, 3000); </script> this automatically display error during refresh or every time p

bloomberg - How can I conditionally reorder EPS data in an Excel table using visual basic for applications based on the frequency of the earnings announcements? -

i have downloaded earnings per share data bloomberg large number of assets 1 year. resulting table measures 4 rows , around 3000 columns. columns contain 4 values, contain two, , contain 1 because of differences in reporting requirements: some companies announce earnings on annual basis (31/12: 1 value) some companies announce earnings on semi-annual basis (31/6 , 31/12: 2 values) some companies announce earnings on quarterly basis (31/3, 31/6, 31/9, 31/12: 4 values) the table values (b17:dkz20) preceded 1 column of announcement dates (a17:a20), correspond quarterly announcements of first company in list, because highest possible frequency , covers possible dates earnings announcements (31/03; 31/06; 31/09; 31/12). because used: range(b17:dkz17).formula = "=bdh([ticker], ""is_eps"", [beginning date], [end date], ""dates, period"", ""h,m"")" with optional argument hide dates in order display values d

python - make subplots from an astronomical fits image -

i have set of rgb images , made rgb fits image aplpy , overlaid contours on image cut image , make small fits images see peaks of contour. import aplpy import atpy pyavm import avm import asciitable import matplotlib import matplotlib.pyplot plt matplotlib.colors import lognorm,boundarynorm import montage_wrapper astropy.io import fits import pyfits astropy import wcs fitsfile = 'rgb.fits' fitsfile_2d = 'rgb_2d.fits' pngfile = 'rgb_arcsinh_contour.png' figfile = 'rgb.png' w = wcs.wcs(naxis=2) # set "airy's zenithal" projection # vector properties may set python lists, or numpy arrays w.wcs.crpix = [5.70000000e+03, 3.05000000e+03] w.wcs.cdelt = np.array([-6.611111263e-05, 6.611111263e-05]) w.wcs.crval = [23.166667, -7.666667] w.wcs.ctype = ["ra---tan", "dec--tan"] w.wcs.cunit =["deg","deg"] # print out of contents of wcs object w.wcs.print_contents() # pixel coordinates of interest. pixcrd

csv - Retrieve line from text file with VBA -

i'm working on vba application want open csv file, contents of line, , store in string. i've got working, seems to bit of brute force approach , feel there should more elegant way of doing loading every single line until 1 want string. dim rowcount long dim currentline long dim objfso, objfile const forreading = 1 rowcount = 0 set objfso = createobject("scripting.filesystemobject") set objfile = objfso.opentextfile(filename, forreading) 'open specified file currentline = 0 'start line "0" message = objfile.readline 'read contents of first line while currentline < eventnumber 'if current line being examined not specified line currentline = currentline + 1 'increment current line counter message = objfile.readline 'and copy specified line message string loop 'and repeat objfile.close

playframework - How to remove the .isDefined in the following scala snippets -

in slick query have: def getabc(userid: option[int], levelid: option[int]): list[user] = { val q = { m <- users if m.approved && userid.isdefined && m.userid ==== userid.get && levelid.isdefined && m.levelid === levelid.get } yield m q.list() } i don't how using isdefined , .get in above, how can remove them? val user: option[user] = .... if(user.isdefined) { val productsales:list[product] = getproducts(user.get.id) val isboss = (user.get.levelid.isdefined && (user.get.levelid.get == 10)) } in above, have 2 levels if isdefined checks, how can around type of pattern? scala> val userid = some(1) userid: some[int] = some(1) scala> val levelid = some(2) levelid: some[int] = some(2) scala> { u <- userid | l <- levelid | q = u + l // query | } yield q res0: option[int] = some(3)

perl - Extract data from two flat files using a key (phone_no) and print or purge matching records -

here set of final assignment this final assignment. i have been given fixed flat file withemployee list below. employee (20 bytes) title (20 bytes) dept (13) phone (14) example abad, rachel pr clerk engineering engr dist ofc (818) 374-7538 abdullah, solom safety engr press ves inspectio (818) 374-9930 abel, darla sr safety eng elevatorsinspection (213) 202-9839 abraham, teresa sr mgmt analyst ii res mgmt cus (213) 482-6766 abramyan, daniel inactive none none abreu, james build mech inspectorcode enfcmnt (818) 374-9862 acevedo castro, mech engrg ass engineering (213) 202-9902 acosta, jesus geotech engineer ii inspection grading (213) 482-6967 aghazarian, sako srbuild inspector inspection bldg(213) 482-0372 a second file contains list of phone numbers, happen on list of employee list. (818) 374-9930 (213) 202-9902 (213) 482-0373 (818) 374-7538 if there match, need extract , printout entire

xml - Is there a way to extend a DTD used for validation? -

i wondering whether there standard way extend dtd or whether way validate document add necessary extensions in xml file. i have system of plugins organized packages in linux installation (i.e. plugins can depend on 1 or more plugins, loops not allowed): +----------------------+ +-->| editor |<--+ | +----------------------+ | | | +-----------------+ +-----------------+ | locale | | image | +-----------------+ +-----------------+ ^ ^ | | | +----------------------+ | +---| geomap |---+ +----------------------+ so, have dtd in editor plugin with, example, widget tag has attribute named auto-save this: <!element widget (value|preset|default|state)*> <!attlist widget id id #required type

html - PHP DOMDocument and getElementsByTagName questions? -

i trying read h1 value html string below, <h1> <a href="http://example.com/?p=5016"> love me reason </a> </h1> i using following code returns empty value title content seems working (next line) ? why libxml_use_internal_errors(true); $dom_document = new domdocument(); // create new document $dom_document->loadhtml(mb_convert_encoding($row['html'], 'html-entities', 'utf-8')); // load string document $article_titles=$dom_document->getelementsbytagname("h1"); $title = $article_titles->textcontent; //this works fine $article_contents=$dom_document->getelementbyid("article-single"); $content=$article_contents->textcontent; libxml_use_internal_errors(false); the title content empty because $article_titles still domnodelist . since getting elements tag name expect return 1 or more element opposed getting elements id , expecting 1 since supposed unique. you must target domele

vb.net - MySQL Connection String Using FQDN -

is possible connect on mysql server using fqdn? e.g. from dim con mysqlconnection = new mysqlconnection("data source=192.168.90.99;database=testdb;user id=testadmin;password=adminpass;") to dim con mysqlconnection = new mysqlconnection("data source=myserver.oldcompany.com;database=testdb;user id=testadmin;password=adminpass;") where myserver.oldcompany.com fqdn if so, need other configuration on server setup etc? of course. write in /etc/hosts file string: myserver.oldcompany.com 192.168.90.99 check correctness ping myserver.oldcompany.com done.

java - how to quantize the image to MxN blocks -

certainly, writing program image ascii conversion. have convert image grayscale, don't know write code of quantizing image mxn blocks for every sub-image of mxn size, compute average gray value store computed average gray value new image). here program: public static char[][] imagetoascii(image img, int blockwidth, int blockheight) { { // convert image type image bufferedimage bufferedimage bufimg = convert(img); // scan through each row of image for(int j=0; j<bufimg.getheight(); j++) { // scan through each columns of image for(int i=0; i<bufimg.getwidth(); i++) { // returns integer pixel in default rgb color model int values=bufimg.getrgb(i,j); // convert single integer pixel value rgb color color oldcolor = new color(values); int red = oldcolor.getred(); // red value int green =

python 2.7 - List of records not fetching updated records in Django REST framework..? -

in django rest framework api, list of database table records not getting updated until api restart or code change in python files model, serializer or view. i've tried transaction commit didn't worked. below view : class serviceviewset(viewsets.modelviewset): #authentication_classes = apiauthentication, queryset = service.objects.all() serializer_class = serviceserializer def get_queryset(self): queryset = self.queryset parent_id = self.request.query_params.get('parent_id', none) if parent_id not none: queryset = queryset.filter(parent_id=parent_id) return queryset # make service readable def update(self, request, *args, **kwargs): return response(status=status.http_400_bad_request) def destroy(self, request, *args, **kwargs): return response(status=status.http_400_bad_request) serializer looks : class serviceserializer(serializers.modelserializer): class meta:

ios - NSMutableattributed string not working for substring -

-(nsmutableattributedstring *)getattributedstringforstring:(nsstring *)totalstring filtertext:(nsstring *)filtertext font:(uifont *)titlefont backgroundcolor:(uicolor *)bcolor foregroundcolor:(uicolor *)fcolor { nsmutableattributedstring *attributedstring = nil; nsdictionary *filtertextattribute = @{nsbackgroundcolorattributename:bcolor, nsforegroundcolorattributename:fcolor, nsfontattributename: titlefont}; attributedstring = [[nsmutableattributedstring alloc] initwithstring:totalstring]; [attributedstring beginediting]; [attributedstring setattributes:filtertextattribute range:[totalstring rangeofstring:filtertext options:nscaseinsensitivesearch]]; [attributedstring endediting]; return attributedstring; } i applying nsmutableattributedstring filtertext in totalstring if filtertext totalstring above setattributes working otherwise not working substrings

css - Create four color gradient mixin in bootstrap -

Image
i wanted create 2 color gradient using bootstrap mixin functions. gradient should this: when using bootstrap gradient mixin found there no function match requirement. tried making own gradient mixin , added bootstrap/less/mixins/grandients.less. function didn't job.. this gradient mixin added gradients.less .vertical-custom(@start-color: #ed3537; @start-percent: 0%; @mid-color: #ed3537; @color-stop: 50%; @mid-color-2: #fb3e40; @color-stop-2: 50%; @end-color: #fb3e40; @end-percent: 100%) { background-image: -webkit-linear-gradient(top, @start-color @start-percent, @mid-color, @color-stop, @mid-color-2, @color-stop-2, @end-color @end-percent); // safari 5.1-6, chrome 10+ background-image: -o-linear-gradient(top, @start-color @start-percent, @mid-color, @color-stop, @mid-color-2, @color-stop-2, @end-color @end-percent); // opera 12 background-image: linear-gradient(to bottom, @start-color @start-percent, @mid-color, @color-stop, @mid-color-2, @color-stop-2

selenium - Appium iOS : How to find child element of an element -

Image
appium : 1.3.1 mac os x 10.9.4 i face scenario need iterate loop through results , click on 1 of them if text matches. as per hierarchy structure looks this >uiatableview > uiatablecell >uiastatictext > uiatablecell >uiastatictext > uiatablecell >uiastatictext > uiatablecell >uiastatictext click action works fine if take list uiatablecell. i took list listingresults @iosfindby(classname="uiatablecell") (webelement resultnum : listingresults) { resulttext= resultnum.gettext().trim(); if(!resulttext.contains("more option")){ system.out.println(resulttext); } } resultnum.gettext() not returning text. , text need "uiastatictext". q. i'm trying use findelement , expecting resultnum.findelement(by.classname("uiastatictext")).gettext() return text. not working... i got answer here as per jlipps

arrays - algorithm - LinkedIn Coding Round -

an array containing 0s , 1s given input. can pick 2 indices of array , j , flip elements between them ( i.e 0->1 , 1->0). find maximum sum of array can obtained after flip. ex: [0,1,0,0,1,0], answer 4.(flip index 2 3). here approach: 1)find prefix sum ( keep in sum[i]) indices in array. 2)flip bits in original array. 3)use kadane's algo find max subarray sum maxsum.let start , end indices of max subarray , j. 4)the answer sum(i-1)+maxsum+sum(n-1)-sum(j). please tell me if approach right. actually, can in 1 pass on array. keep track of how current range of flipped bits doing. long in positive, current range prepend subsequent range. once 0 or negative, should discard range , start new range. for example, if find flipping indices 0..5 results in +4, , want keep 0..5 part of range because benefit if going flip indices 6..x. if 0..5 results in -1, want not use 0..5 because lowe

javascript - Knockout ViewModel observable variable combine with computed -

i'm playing around knockout.js data-binding quite long time. but, got stuck problem. actually, enhancement i'm trying do. now i'm trying this, i've observable variable in vm i've math equation each observable variable every time model updated, before reach view, variable should computed equation , set result on view. currently, i'm taking 3 variable job done. var variable = 'x01'; //vm - object of view model. vm[variable] = ko.observable(24.8); vm["+variable+"_conversion"] = "x * 10 - 248"; vm[""+variable+"_computed"] = ko.computed(function() { val_ac = vm[variable](); ac = vm[""+variable+"_conversion"]; var x = val_ac; return eval(ac); },vm); to update model: vm[variable] = 25; since, views custom handlers. i'mr eading data below: value = vm[""+variable+"_computed"](); but, here im using 2 variables (though second 1 not ho

arrays - User input to matrix in C++ -

i have trouble read in input user , convert them matrix calculation. example, input = {1 2 3 / 4 5 6} , program should read in matrix in form of 1 2 3 4 5 6 which have 3 cols , 2 rows. got far not seem work: input.replace(input.begin(), input.end(), '/', ' '); stringstream ss(input); string token; while (getline(ss, token, ' ')) { (int = 0; < row; i++) { (int j = 0; j < col; j++) { int tok = atoi(token.c_str()); (*matrix).setelement(i, j, tok); } } } so i'm trying break input token , store them matrix using setelement function take number of row, column , variable user want store. wrong code variable of tok doesnt seem change , keep stuck in 0 . assuming row , col knows. thanks help. although many simple ways exist solve specific problem (and other answer have various suggestions) let me try give mo

vb.net - Get FileInfo of a file on server -

i have file following uri http://10.20.80.001/mobilepayment/hi.cer published in iis . there way date created of file in vb?? want dim fullpath = http://10.20.80.001/mobilepayment/hi.cer dim inforeader system.io.fileinfo inforeader = my.computer.filesystem.getfileinfo(fullpath) dim filetimestamp string = inforeader.lastwritetime.tostring("yymmddhhmmss") thanks! you need file uri. until you've done string. so either perform web request , download temporary location, use location "fullpath" or when request inspect http headers last modified date.

haskell - Convert Markdown To HTML Symbols -

i'm writing program in haskell converts markdown html , right im trying write basic function convert main symbols , seem having issues function , error code vague stating "testing.hs:15:28: parse error on input ‘&’" following have: symbol x " " = "" symbol x (y:ys) | x == '&' = '&amp;' : (symbol ys) | x == '<' = '&lt;' : (symbol ys) | x == '>' = '&rt;' : (symbol ys) | otherwise = y : (symbol ys) any in explaining i'm doing wrong appreciated thanx some things should rectify: use string instead of char representing &amp; . recursive call symbol not complete. missing arguments. symbol :: [char] -> [char] -> [char] symbol x " " = "" symbol x (y:ys) | x == "&" = "&amp;" ++ (symbol x ys) | x == "<" = "&lt;" ++ (symbol x ys)

Font "HelveticaNeue.ttf" deviation in android lollipop -

Image
i using "helveticaneue.ttf" custom font in android app; previous versions of android fine, lollipop stretching usual font, has solution? have here: https://code.google.com/p/android-developer-preview/issues/detail?id=608&thanks=608&ts=1404735239 especially comment #13 nov 3, 2014 i had same problem , worked me. good luck!

javascript - IE 8 nextSibling Property behaving weirdly -

i using following markup code in project. <td> <a style="font-size: small" id=maincontent_refdatamgr_gridregion_lblregionname_8 title="click select row" onclick=javascript:onrowclick(this); href="javascript:__dopostback('ctl00$maincontent$refdatamgr$gridregion$ctl10$lblregionname','')">test </a> <input id=maincontent_refdatamgr_gridregion_hdnregionid_8 value=82 type=hidden name=ctl00$maincontent$refdatamgr$gridregion$ctl10$hdnregionid> </td> function onrowclick(objrow) { var hdnselectdgridrowregionid = document.getelementbyid('<%=hdngridrowselectedregionid.clientid%>'); hdnselectdgridrowregionid.value = objrow.nextsibling.nextsibling.value; } so if anchor element contains space in text (test ) objrow.nextsibling.nextsibling.value not working , have use objrow.nextsibling.value in chrome it's working fine if t

android - I am getting the items in Listview repeated . Here is my sample code I am unable to find the bug in my code ! Can anyone help me out please? -

//this joblistadapter class package com.example.hellotest.adapters; import java.text.parseexception; import java.text.simpledateformat; import java.util.list; import java.util.locale; import android.content.context; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.baseadapter; import android.widget.textview; import com.example.hellotest.r; import com.example.hellotest.model.job; public class joblistadapter extends baseadapter { private layoutinflater minflater ; private list<job> mjobs; private simpledateformat mdateformat; private simpledateformat minputformat; private string mposterprefix; public joblistadapter(context context) { minflater = (layoutinflater) context.getsystemservice(context.layout_inflater_service); mdateformat = new simpledateformat("dd mmmm yyyy&quo

ios - Coredata predicate IN operator with like or contain -

i have 2 arrays on have wildcard search , using in operator in operator gives me exact matching want fetch results contains searchterm. possible through in operator or have manually loop through records , match pick record want. current code : nsarray *filteredarray = [brandsfabric filteredarrayusingpredicate:[nspredicate predicatewithformat:@"self.color_name in %@ or self.subcategory_name in %@",colornamesarray,patternnamesarray]]; desired functionality this: nsarray *filteredarray = [brandsfabric filteredarrayusingpredicate:[nspredicate predicatewithformat:@"self.color_name in like/contains %@ or self.subcategory_name in like/contains %@",colornamesarray,patternnamesarray]]; this expensive operation, can try: nsmutablearray *predicates = [nsmutablearray array]; (nsstring *name in colornames) { [predicates addobject:[nspredicate predicatewithformat: @"color_name contains[cd] %@", name]]; } (nsstring *name

android - Visual Studio 2015 Mobile Cross Platform -

with new release of visual studio 2015 preview, there possibility newest visual studio allow develop mobile cross platform (ios, android, wp8...) using .net language c# or vb.net? refer article: http://arstechnica.com/information-technology/2014/11/visual-studio-2015-goes-even-more-cross-platform-with-clang-android-emulator/ visual studio mobile cross platform use apache cordova (html5), can use c# (no vb.net) xamarin (in xamarin studio or visual studio xamarin integration)

php - image creating slow down servre -

i have function , funqction i`m trying create images in server foreach($value[0] $imagekey => $imageval) { $imgname = $gancxadeba . '_' . $imagekey; $saveaddr = dirname(dirname($_server['php_self'])).'/www/classifieds_images/'; $as = '.jpg'; $originalname = $imgname . $as; if(!file_exists($saveaddr.$originalname)) { if (preg_match('/\.(jpg)$/', $imageval)) { $getfile = imagecreatefromjpeg($imageval); } elseif (preg_match('/\.(jpg)$/', $imageval)) { $getfile = imagecreatefromjpeg($imageval); } elseif (preg_match('/\.(png)$/', $imageval)) { $getfile = imagecreatefrompng($imageval); } else { $getfile = imagecreatefromgif($imageval); }

Is there any java library /API / Framework to capture browser events? -

i know selenium used automation . need java library / api / framework capture events of browsers in order there id, class or xpath of clicked elements. yes have, first of framework , element identifications both different things. lets first deal elements, identify them have plug-ins fire-path,firebug in firefox browser helps identify element xpath, css. mentioned frameworks in question can use frameworks junit (if using java),nunit (if using c#) , testng. link firebug selenium ide offical site locating web-elements

python - install psycopg02 from PyCharm error -

i'm trying add psycopg02 package django project using virtualenv. i'm new in python/django development , new apple mac os x. please find screenshot of error here i fix installing enterprisedb postgresql , create virtualenv through terminal instead of pycharm

javascript - addEventListener click executed before clicked -

i want pass on parameters in click function. var albums = document.getelementsbyclassname("album"); for(var = 0; i<albums.length; i++){ document.getelementbyid(albums[i].id).addeventlistener("click", goalbum(albums[i].id), false); } however, function "goalbum" gets excecuted when created, , function won't excecute anymore. doing wrong? goalbum getting executed because called function. weren't "creating" function. intended supply addeventlistener logic execute when clicked; logic being "invoke goalbum ". this, wrap function call in anonymous function. function toarray(list) { return array.prototype.slice.call(list); } var albums = toarray(document.getelementsbyclassname("album")); albums.foreach(function (album) { document.getelementbyid(album.id).addeventlistener("click", function () { goalbum(album.id); }, false); }); additionally, because it unwise create f

c# - What's is th best way to manage pictures WP 8.1 -

actually i'm developing "social" app office , i'm wondering what's best way load or manage pictures. each user has profil picture , display wherever want, on profil view, in contacts list (little smaller) example. when user creates profil, picks picture picture library on phone , it's send server base64 encoded string. code i've used save picked picture on server (sql server 2012 database): var reader = new datareader(picturestream.getinputstreamat(0)); byte[] bytes = new byte[picturestream.size]; await reader.loadasync((uint)picturestream.size); reader.readbytes(bytes); string bytesstring = convert.tobase64string(bytes); so here bytesstring contains base64 encoded picture send on server. atually, i'm facing 2 problems. first problem : the base64 encoded string cannot inserted database if column type varchar(max) . string cut in table. second problem : if want build picture bytesstring decoding base64 string, takes time it's not po

swing - rotating coordinate plane for data and text in Java -

Image
i need to: 1.) move origin , rotate coordinate plane x-values progress rightward , y-values progress upward new origin(which needs bottom left corner of inner, blue rectangle in code below). enable me plot points @ x,y coordinate pairs in code below. 2.) plot rotated labels tic marks on y-axis of data plot. the code below sets problem. works, except 2 problems: 1.) data points being plotted upper left hand corner origin , y-values descending downward 2.) labels tic marks on y-axis not being drawn on screen can show me how fix code below fixes these 2 problems , first paragraph above describes? the code in following 2 java files: datagui.java import java.awt.*; import java.util.arraylist; import javax.swing.*; class datagui extends jframe{ datagui() { super("x,y plot"); this.setdefaultcloseoperation(jframe.exit_on_close); this.setpreferredsize(new dimension(800, 400)); this.pack(); this.setsize(new dimension(800, 600));