Posts

Showing posts from September, 2014

javascript - What are registry and defined under require.s.contexts._? -

what require.s.contexts._.defined , require.s.contexts._.registry ? are modules in registry object defined ? require.s.contexts contains private data regarding contexts requirejs knows about. default context if not use context configuration option called _ require.s.contexts._ contains private data regarding default context. the registry field of context data contains map hold module information temporarily . module in map after has been requested until has been loaded. the defined field contains map of modules defined in context. conceivably access directly there's no clear reason since require.defined(id) tell whether module named id defined in context require belongs. (different contexts different instances of require require function knows context originated from.)

wordpress - Updating post in frontend: send post ID to functions.php -

this simple form i'm suing update posts in frontend: <?php $current_post = $post->id; ?> <form action="" method="post"> <input type="text" name="title" value="<?php echo $title; ?>"> <textarea name="text"><?php echo $content; ?></textarea> <input type="submit" value="edit post"> <?php wp_nonce_field( 'edit_post', 'edit_post_nonce' ); ?> <input type="hidden" name="edit_post" value="true" /> </form> in functions.php, have following script (i remove verifications lines): if( 'post' == $_server['request_method'] && !empty( $_post['edit_post'] )) { global $current_post; $post = array( 'id' => $current_post, 'post_type' => 'post', 'post_title' => wp_strip

c - Fork a child process,runs permanently in the background and do work -

i want fork child process runs permanently in background, , parent prompt user enter line of text. display number of lines entered user in child process. how it?? #include <stdio.h> #include <stdlib.h> #include <sys/types.h> int main ( int argc, char *argv[] ) { int i, pid, status; pid = fork(); switch(pid){ case -1: printf("fork error"); break; case 0: printf("in child pid %d\n", (int)getpid()); // print out number of lines on screen while(1); break; default: printf("in parents pid %d\n", (int)getpid()); printf("\nplease enter somthing...\n"); // maybe counting here? , send on child? wait(&status); break; } } #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <unistd.h> #include <string.h> void do_parent(); void do_child(); int fd[2] = { 0 }; int m

session - Java okHttp reuse keep-alive connection -

how reuse http keep-alive connection via okhttp? my code sample: public class mainwithokhttp { static okhttpclient _client = new okhttpclient(); public static void main(string[] args) { ... query1(); ... // in request request _request = new request.builder() .url("...") .addheader("connection", "keep-alive") .addheader("cookie", _cookie) .post(postparams) .build(); // in request previous session closed, why? // previous session = session created in query1 method response _response = _client.newcall(_request).execute(); ... } ... private static void query1() { ... request request = new request.builder() .url("...") .addheader("connection", "keep-alive") .addheader("cookie", _cookie) .g

android - setting URL in build.gradle? -

i trying install adobe creative cloud sdk in app. , according developer docs, say, set sdk location in way. allprojects { repositories { mavencentral() jcenter() maven { url "${project.rootdir}/mvn-repo/release" //add correct location of creativesdk library files } } } now , doubt , right sdk in system located in , d:\apps\futurister\futurister\app\creativesdk-repo now, how add correct location of creative sdk in gradle file? thanks, using android studio, add repositories in local, set link manually direct link: maven { url "d:/apps/futurister/futurister/app/creativesdk-repo/release" } or use $ function directory, ex: maven { url "${system.env.home}/creativesdk-repo/release" }.

email - Send mail from result (should be easy) -

i have built script check local machine certificates issuer expiring within 400.000 days (to hit when testing it) on remote server, cant figure out how result send actual email experimenting pipes after (and in) if statements doesnt seem work. have been googling quiet alot (ofcourse) i'm new powershell , code difficult @ times interpret. i looking like; if $outputfromtheifstatement | measure-object -gt 0 { send email using $sendreportnow.} my code: $servers = 'testserver1,'testserver2' $threshold = 400000 $deadline = (get-date).adddays($threshold) $mailsmtp = '-smtpserver smtpserver.domain.com -port 25' $mailto = "receiversmailaddress@company.com" $mailfrom = "sendersmailaddress@company.com" $mailsubject = '-subject certifikat expiring within 90 days' $mailbody = '-body ?' $sendreportnow = 'send-mailmessage $mailsmtp $mailfrom $mailto $mailsubject' invoke-command -computername $servers { get-childitem cert:\

jquery - When Ajax works but doesn't -

i have been scouring internet solution. don't think language specific, i'm in coldfusion using jquery ajax out cute little dialog. code works on many computers, different servers, iis , apache...but me, no. ajax calls work fine in code, if fails in call, i'm supposed see "ok" script box popup. , these calls, things see...but when dig actual call , @ ajax sending , receiving correct...well 1 thing not there reason on computer, return has preceeding whitespace in json data...no 1 else has problem...but running same code. of research points things wrong causing ajax fail...but not technically problem...ajax works fine , returns 99% of expect to. have believe there environmentally different or "outside" (at least of code) impacting results treated invalid...but again, same code works in many "elsewheres". here gist of pretty simple code: $(document).ready(function() { $('##viewaction').on('shown.bs.modal', function

Trying to switch screens when player dies in visual studio using xaml -

when player dies game exits want display mainmenu.xaml it's follows: public void onplayerdeath(){ game.exit(); } what way make go main menu.xaml frame instead of game.exit? create instance of mainmenu window , show it. public void onplayerdeath() { mainmenu mm = new mainmenu(); mm.show(); }

sql - Having issues using a Right Join in MS Access 2010 with two tables that have the same fields -

Image
i have 2 tables, table , table b. each table have 4 fields, name of fields same both. both tables extracted other tables, , each record acts primary key. i want write query in ms access 2010 gets data unique table b , not shared table a. using following image reference, , looks need right join. hello. there not right sql, i've tested , getting incorrect result. below closest i've gotten: select distinct tableb.* tableb right join tablea on (tableb.field1 = tablea.field1) , (tableb.field2 = tablea.field2) , (tableb.field3 = tablea.field3) , (tableb.field4 = tablea.field4) (((tablea.field1) null)); i think clearer use not exists : select tableb.* tableb not exists (select 1 tablea (tableb.field1 = tablea.field1) , (tableb.field2 = tablea.field2) , (tableb.field3 = tablea.field3) , (tableb.field4 = tablea.field4) ); your use of right join incorrect. phrased, want left join . is, want keep rows in firs

c# - Code Cop App just hangs -

Image
i written test application using code cop, method interception approach. however, ran first application hit snag whereby application fire , hang no information happening. i had followed code , able run same code on machine. there no error information being output, hangs. does know how may able solve or debug issue? my solution contact ricardo barbosa @ codecop proceeded me solve issue promptly , explaining why occurring. my issue due not having correct clrjit.dll on machine c:\windows\microsoft.net\framework a windows update solved issue. what's happening when codecop application runs creates folder in %temp%/codecop , downloads symbol files microsoft calculate method addresses. the version had 4.6.57.0 in v4.0.30319 framework folder. for reason there no symbol file microsoft public symbol server version of clrjit.dll running fiddler while starting application showed case. after performed windows update got version 4.6.100.1 of clrjit.dll a

NetLogo passing link breed as procedure parameter -

i writing utility procedure identifies new link-neighbors of nodes in turtle-set. want able use same procedure link breed. function (not tested). to-report all-neighbours [ nodeset edgetype ] let nbr nobody ask nodeset [ set nbr (turtle-set nbr edgetype-neighbors) ] report nbr [ not member? self nodeset ] end this fail syntax checker because edgetype-neighbors not valid version of breed-neighbors . there way pass link breed called procedure? i think can work around using network extension nw:set-context nodeset edgetype , nw:turtles-in-radius 1 better way , may need same general thing link procedures don't have nw versions. get links specified breed , use [other-end] turtles: to-report all-neighbours [ nodeset edgetype ] let nbr nobody ask nodeset [set nbr (turtle-set nbr [other-end] of (my-links [breed = edgetype]))] report nbr [ not member? self nodeset ] end usage (if breed e.g. relations/relation): ask all-neighbours (turtle-set turtle

How can I test to make sure an application that use github's api works correctly for private repos? -

i don't have private github repositories, want create application works people do. how can test ensure app work private repos without paying one? can ask have private repo test out? you'll need real user real private repositories, there's no "testing mode" in api allow test if app works.

ruby - Take screenshot using watir extension element screenshot -

i using watir web driver, go url , fetch screenshot. i able take screenshot whole page, unable take particular element. tried watir extension element still not able figure it. this code require "watir" require 'watir/extensions/element/screenshot' browser = watir::browser.new browser.goto "http://images.morefrom.co.uk/prodmainimg.aspx?pn=7350022730991&man=multibrackets" browser.screenshot.save 's.jpg' i want take screenshot of particular image in page there no div, tried browser.body.img.screenshot.save 's.jpg' `screenshot': wrong number of arguments (0 1) (argumenterror) what should doing? i think have found it browser.body.img.screenshot("s.jpg")

equation - how to show fraction with denomainator, horizantal line and numerator on run time in android -

is there any why show fraction neat , clean in android denominator, horizontal line , numerator for example 4/5+x + 3 would be 4 _____ + 3 5 + x actually want show algebraic equation on run time. please tell me answer working on since 4 or 5 days no success achieved. try this: mainactivity code: public class mainactivity extends activity { edittext etinput; linearlayout resultlayout; button btnresult; viewtreeobserver mvto; int widthofline; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); etinput = (edittext) findviewbyid(r.id.etinput); btnresult = (button) findviewbyid(r.id.btnshowres); btnresult.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { string temp = etinput.gettext().tostring().trim(); if(temp.contains("/")){ system.

javascript - iOS XMLHttpRequest's responseXML Is null When responseText.length > 10000000 -

a web application of mine has begun failing suddenly. xmlhttprequest's responsexml null in safari on ios, though desktop , windows phone browsers tested parse xml , non-null responsexml. after lots of guessing , checking tonight, discovered ios's responsexml null when responsetext's length greater 10000000 (10 million characters). testing on ios 9.0.2 ipad 2. does know how exceed 10000000-character limit? can't find documentation quirk. thank you.

python - How can I query for float/int value or string in a django model using Q Objects? -

django version=1.8 , ide=pycharm, python 2.7 i have search form , want search , list items("products") in model based on string matching product title or product description or product price. below "searchitems" part inside views.py . im confused line below in get_queryset function. cheers qs = super(productlistview, self).get_queryset(*args,**kwargs) # # search inside model function def get_queryset(self, *args, **kwargs): qs = super(productlistview, self).get_queryset(*args,**kwargs) query = self.request.get.get("q") if query: qs = self.model.objects.filter( q(title__icontains=query) | q(description__icontains=query) | q(price=query) ) return qs class productlistview(listview): model = product queryset=product.objects.all() #no need define default def get_context_data(self, *args, **kwargs): context = super(productlistview, self).get_context_data(*

php - stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding not working for UITextView -

i have search field, uitextview , user enters data searched in mysql database in server. the search , php xcode calls work normal characters, encoding doing not seem work correctly special characters such ā, example. have managed save data special characters mysql database, reason code doing search not seem encode data correctly. the current code have is: nsstring *searchstring; searchstring = [searchtextfield.text stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]; searchstring = [searchstring stringbyreplacingoccurrencesofstring:@" " withstring:@"%20"]; searchtextfield.text uitextview . ideas why not working? ok - have solved problem don't understand why. grateful explanations. the way have solved problem, way seems using hammer crack nut, saving string searching in sqlite database. once saved, assigned searchstring , gets encoded properly. can explain why case?

c# - Visual Studio 2015 does not recognize InternalVisibleTo from friendly assemblies -

i have 2 c# assemblies, , b. in a, used [assembly: internalsvisibleto("b")] to make internal types/methods/properties in available b. works , builds fine. however, if load project b in visual studio 2015, see references internals in marked errors, error message being: "someclassdefinedina" inaccessible due protection level. used work in visual studio 2013. anyone else seeing this? solutions?

c# - Get Entity Table Name - EF7 -

as question states, know how entity table name in entity framework 7? i have code in entity framework 6.1 (from site, cant find link), none of interfaces/objects seem referenced in entity framework 7. code ef6.1 public string gettablename(type type) { var metadata = ((iobjectcontextadapter)this).objectcontext.metadataworkspace; var objectitemcollection = ((objectitemcollection)metadata.getitemcollection(dataspace.ospace)); var entitytype = metadata.getitems<entitytype>(dataspace.ospace).single(e => objectitemcollection.getclrtype(e) == type); var entityset = metadata.getitems(dataspace.cspace).where(x => x.builtintypekind == builtintypekind.entitytype).cast<entitytype>().single(x => x.name == entitytype.name); var entitysetmappings = metadata.getitems<entitycontainermapping>(dataspace.csspace).single().entitysetmappings.tolist(); entityset table = null; var mapping = entitysetmappings.singleordefault(x => x.entityset

java - getImage() throws exception on commandline but not in eclipse? -

i'm loading images using following function: public static image loadimage(string path){ log.debug("loadimage> path: "+path); return toolkit.getdefaulttoolkit().getimage(clientapp.class.getclassloader().getresource(path)); } utils.loadimage("images/carrot_stage_0.png") this function throws nullpointerexception when package jar , run command line: - loadimage> path: images/carrot_stage_0.png java.lang.nullpointerexception @ sun.awt.suntoolkit.getimagefromhash(unknown source) @ sun.awt.suntoolkit.getimage(unknown source) @ com.tate.world.client.utils.loadimage(utils.java:11) @ com.tate.world.client.carrot.<init>(carrot.java:24) @ com.tate.world.client.inventory.<init>(inventory.java:32) @ com.tate.world.client.drawpanel.<init>(drawpanel.java:35) @ com.tate.world.client.clientframe.doinit(clientframe.java:46) @ com.tate.world.client.clien

javascript - If a or b = null or no value then... Filling in last field overrides function? -

i have code: if(document.getelementbyid('usertype_2').checked) { if(a==null || a=="", b==null || b=="", c==null || c=="", d==null || d=="", k==null || k=="", e==null || e=="", g==null || g=="", h==null || h=="", j==null || j=="", k==null || k=="") { document.forms["619new"]["next1"].disabled = true; document.forms["619new"]["next1"].style.background='#fdfdfd'; document.forms["619new"]["next1"].style.color = 'lightgray'; document.forms["619new"]["next1"].style.border = 'none'; document.forms["619new"]["next1"].style.cursor = 'not-allowed'; } else { document.forms["619new"]["next1"].disabled = false; document.forms["619

javascript - Semantic-UI Form Validation Quirk -

i'm using semantic-ui react time. i've used semantic-ui's form , form validation in other products in past , i've never had problems such 1 going explain now. in past when used semantic-ui's form validation, when set on property change , fields show inline error message if there change in field. however, reason, editing on field possibly trigger fields validate , show of inline errors if fields either empty or not contain correct value. not pleasing eye , prefer not have form function in way. what possibly cause this? , how 1 avoid this? i've setup form usual... here example: $('.ui.form.inputform') .form({ on: 'change', inline:true, fields: { name: { identifier: 'name', rules: [ { type:'empty', prompt: 'name required' },

c# - How to link a cshtml page using href in mvc4 -

i want link menu.cshtml page using anchor-tag href whenever click on menu link in navbar should direct me menu.cshtml. have tried few times using code not able it. here code using: <a class="page-scroll" href="~/views/home/menu.cshtml">menus</a> you try use actionlink html helper , let way framework produce correct link. @html.actionlink("menus","menu","home", null, new { @class = "page-scroll" })

ios - I m trying to access google places api with following url but unable to get results -

https://maps.googleapis.com/maps/api/place/textsearch/json?location=-33.8670522,151.1957362&radius=500&types=food&name=cruise&key=api_key but unfortunately m inable result , displays error message: { "error_message": "this ip, site or mobile application not authorized use api key. request received ip address 106.67.62.253, empty referer", "html_attributions": [], "results": [], "status": "request_denied" } you need create project google developer console . link or link 2 add create new project, add credential, api , enable location service. this may you.

web scraping - Reading only the relevant text from an HTML page using R -

is there way access textual content on wikipedia using r. equivalent jsoup shown in post on stack extraction of text using: jsoup thanks. from here : # load packages library(rcurl) library(xml) # download html html <- geturl("https://en.wikipedia.org/wiki/main_page", followlocation = true) # parse html doc = htmlparse(html, astext=true) plain.text <- xpathsapply(doc, "//p", xmlvalue) cat(paste(plain.text, collapse = "\n"))

node.js - Mongoose stream & setInterval leading to memory leaks? -

i'm trying diagnose memory leak problem in node application. i'm confused gc in v8, , don't know how prevent memory leaks in node. have below code uses mongoose query stream in setinterval . setinterval(function() { var stream = book .find({}) .stream(); stream.on('data', function(book) { // ... book.updated_at = new date(); book.save(); // ... }); stream.on('error', function(err) { }); stream.on('close', function() { }); }, 1000); can event handlers inside setinterval lead memory leaks?

Set the column width of jQuery DataTables Column Filter -

how set column width of jquery datatables column filter? my code : http://jsfiddle.net/oscar11/aobmk2of/ ... datatable.columnfilter({ splaceholder: "head:before", aocolumns: [ { type: "select", width:"10px" }, { type: "select" }, { type: "select" }, { type: "select" }, { type: "select" } ] }); ... but it's not working. thank you. please apply class. #example select { width:100px !important; }

Switch Locales in TYPO3, "live", on one page -

on set multiple locales on 1 page enlightened can switch locales in php live, during 1 php call. for example, this: $locale_old = setlocale(lc_time, 0); setlocale(lc_time, 'fr_ch'); // setlocale(lc_time, $locale_old); what typo3? have different dates on 1 page should displayed in different languages according content element they're in. as locale renders date set globally, can't done using these 2 typoscript settings: config.locale_all = de_ch config.locale_all = fr_ch is possible @ - , how? this not possible typoscript , because typoscript not executed line line, rather parsed 1 configuration tree passed frontendcontroller (technical call order other way around, not try inner magics of typo3 here). so either need define own wrapper script can call @ needed places stdwrap methods or switch fluid templating , create viewhelper switching you. inside viewhelper can use code mentioned in question. the typoscript setting s

github - Change source file code before publishing on production site using git -

i have created 1 project using node.js , publish using git. per logic, have change variable's value in 'app.js' file (e.g. app environment 'development' 'production', static file path, database connection etc.) every time before publish without fail, else problem occur on production. it's hack tic job , need focus while publishing website production. there option/command in git above stuff automatically? move config variable config file ex: config.js , use in app.js . basically in config.js can define variable in if...else condition block per development or production . if(inproduction()) { // define production variable } else { // define developement variable } note:define inproduction method in config return true if it's production else return false . hope helps you.

Uncaught ReferenceError: $ is not defined. (jQuery, javascript) -

Image
i know "uncaught referenceerror: $ not defined" common problem. have no idea code wrong. googled no solution solve this. in advance! my code below. because code way lengthy, divided 3 jsp files: list.jsp, authormodals.jsp, listauthor.jsp. attach code here, have deleted unrelated code make short. list.jsp: <!doctype html> <html lang="en"> <head> <title>administrator</title> <!-- bootstrap core css - uses bootswatch flatly theme: http://bootswatch.com/flatly/ --> <link href="../css/bootstrap.min.css" rel="stylesheet"> <!-- custom css --> <link href="../css/freelancer.css" rel="stylesheet"> <!-- custom fonts --> <link href="../font-awesome/css/font-awesome.min.css" rel="stylesheet" type="../text/css"> <link href="http://fonts.googleapis.com/css?family=montserrat:400,700" rel="stylesheet"

qt - maliit keyboard - black box on letters -

Image
i've managed install maliit-server , keyboard plugins github . run server , example this export qt_im_module=maliit maliit-server -software & maliit-exampleapp-plainqt keyboard shows expected, there appears black box in center of keyboard. don't know / couldn't find box coming from. i'm using xubuntu (14.04 lts) , qt 5.5 . have experienced problem? that qquickview of extended keyboard panel maliit-keyboard-extended.qml . window handling code seems quite buggy (see inputmethod.cpp ). note code written specific platform (some years ago) , needs adaption other use cases.

regex - Redirect part of URL -

i'm trying redirect: https://www.portal-gestao.com/item/7736-3-ideias-para-afinar-a-sua-m%c3%a1quina-de-vender-na-internet.html to: https://www.portal-gestao.com/artigos/7736-3-ideias-para-afinar-a-sua-m%c3%a1quina-de-vender-na-internet.html that is: replacing item part of url. my code in .htaccess is: rewriteengine on rewriterule ^.+/item/(.+)$ /artigos/$1 [r=301,l] note: joomla 3 site. since item start of url should using rule: rewriteengine on rewriterule ^item/(.+)$ /artigos/$1 [r=301,l,nc,ne] make sure keep rule @ start of .htaccess below rewriteengine on line.

linux - How to code bash script to allow entire commands with spaces? -

so basically, i'm looking way make below bash script work without issue. each of commands works when tested individually, it's in actual script has problem. code below: #!/bin/bash answer="$(/usr/bin/grep "permitrootlogin yes" /etc/ssh/sshd_config)" if [ $answer ]; (perl -pi -e \'s/\"permitrootlogin yes\"/\"permitrootlogin no\"/g\' /etc/ssh/sshd_config) else echo "root login not permitted, no values changed." fi here's happens when try run it: test.sh: line 9: [: permitrootlogin: unary operator expected root login not permitted, no values changed. so basically, rather doing find/replace want on file via perl command, it's trying interpret separate instruction. all attempting @ /etc/ssh/sshd_config file , change relevant entry yes no if "answer" found yes. i'm looking way make work. i've looked @ lot of bash examples on site none of them seem cover specific

sql server - in sqlserver can a user access only to a stored procedure or a function that checks login to a system? -

in desktop application, not store connection information in file. want authenticate user using guest user in sqlserver. guest user can check login via stored procedure or function in sqlserver. function takes 2 parameters user id , password , returns true or false. after login system, gets connection information , has user rights. also guest user should not have right read login table. because if reads table, can admin or others' password. how can achieve system ? thanks. somewhere you'll have store connection key , application must db somehow. you have decide if want use db-rights (grants , permits) or if there master password application , own rights management handled application. db rights can lead hardly solveable problems , leads like: sh$$, cannot solve tiny problem, let's grant rights make work... if application not deal extremely sensible data should prefer masterpassword approach application driven rights system. in 1 of our projects have x

Spring - How do I avoid returning an entire table and then searching for a single row in java afterwards? -

i want query database , return 1 single row. can return entire table - code querying in daoimplementation looks so: sqlmapclienttemplate sqlmap = getsqlclienttemplate(); list<presidents> presidents = new sqlmap.queryforlist("presidents.getallpresidents"); this works fine, have controller method needs return single president. currently, returning entire list method , filtering inside java individual row want. isn't great because shouldn't have request entire table every simple query. how go adding sort of clause? don't know why can't along lines of sqlmap.queryforrow(presidents.getpresidentbyname, "obama"); in president.ibatis.xml file existing bean select statement represented so: <select id="getallpresidents" resultmap="presidents"> select * president </select>

asp.net - Modify existing regex to only match dates with a year between 1900-2100 -

i have dates formatted in following format: 2008-01-01 my current regex (.net) is: ^((((1[6-9]|[2-9]\d)\d{2})-(0[13578]|1[02])-(0[1-9]|[12]\d|3[01]))|(((1[6-9]|[2-9]\d)\d{2})-(0[13456789]|1[012])-(0[1-9]|[12]\d|30))|(((1[6-9]|[2-9]\d)\d{2})-02-(0[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-02-29))$ and handles dates fine. however, how change regex match dates years in between year 1900 , 2100? try following one: ^((((19\d{2})|(20\d{2})|2100)-(0[13578]|1[02])-(0[1-9]|[12]\d|3[01]))| (((19\d{2})|(20\d{2})|2100)-(0[13456789]|1[012])-(0[1-9]|[12]\d|30))| (((19\d{2})|(20\d{2})|2100)-02-(0[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]| [2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-02-29))$ you can see working here .

jquery - Add css file dynamically to ckeditor javascript -

i trying add css file dynamically ckeditor. css file uploaded using uploader on same page editor , oncomplete want add css file ckeditor using below code, function addtoeditor(editorname, fileurl) if(fileurl != '') { var randomnumber = math.random(); alert(_gwebdocroot + fileurl + '?v='+ randomnumber); ckeditor.instances[editorname].config.contentscss = _gwebdocroot + fileurl + '?v='+ randomnumber; } } but above code not work, please me solve issue. regards, neha var doc = ckeditor.instances.editor1.document.$; // shortcut $("<link/>", { rel: "stylesheet", type: "text/css", href: "http://my.little.pony.net/your.css" }).appendto($(doc).find("head"));

wordpress control panel login problems -

i have blog built word press. when want login control panel redirect me page: http://tweld.com/wp-login.php?redirect_to=http%3a%2f%2ftweld.com%2fwp-admin%2f&reauth=1 one time uninstalled word press files , uploaded again. after worked correctly. problem has arisen again. have read of codex guide: http://codex.wordpress.org/login_trouble have in error logs @ hosts backend. try: logout or logout http://www.yourdomain.com/wp-login.php?action=logout disable plugins clear cookies/cache exit browser just troubleshooting purposes try: - switching default theme renaming current theme's folder in wp-content/themes using ftp or whatever file management application host provides. resetting plugins folder using ftp or whatever file management application host provides. sometimes, apparently inactive plugin can still cause problems. renaming or deleting .htaccess file after making backup of file check .htaccess , wp-config.php if correct source

java - 256-bit AES decryption in PHP -

i have working example in java how decrypt (256-bit aes) string using key. need replicate decrypt algorithm in php , got work. this decrypted message in java: csm(mcl/kex rcv/10001031 org/comdata kyn/dsnax6hftkvfcet key/c062e276949d83554d7b5198c52c4c55ed1c65370fa71f8220538a0c3ba23172) yet when call php method gives 10001031 org/comdata kyn/dsnax6hftkvfcet key/c062e276949d83554d7b5198c52c4c55ed1c65370fa71f8220538a0c3ba23172) as can see it's not far off php method doesn't give first 17 characters (i.e. "csm(mcl/kex rcv/" bit). am missing trivial here? this php class: class opensslaes { const method = 'aes-256-cbc'; public static function encrypt($message, $key) { if (mb_strlen($key, '8bit') !== 32) { throw new exception("needs 256-bit key!"); } $ivsize = openssl_cipher_iv_length(self::method); $iv = openssl_random_pseudo_bytes($ivsize); $ciphertext = o

python - How to make Flask-SQLAlchemy automatically rollback the session if an exception is raised? -

i'd setup app built flask-sqlalchemy rollback changes done database if view raises exception bubbles outside view code (i.e. not catched inside). i'd work if objects flushed database in subtransactions, either automatically or directly via session.commit() . something similar django's transaction request wrapping . you can this: @app.teardown_request def teardown_request(exception): if exception: db.session.rollback() db.session.remove() have here teardown_request info. might need set preserve_context_on_exception config variable if in debug mode.

android - can only perform rotation of image view without holding it -

hi guys uses code below perform rotation rotates 1 time , goes original position, how let image stay @ rotated position? <?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromdegrees="0" android:todegrees="90" android:pivotx="50%" android:pivoty="50%" android:duration="1000" android:startoffset="0" /> xml file of code animation rotation = animationutils.loadanimation(this, r.anim.rotate); a.startanimation(rotation); use: anim.setfillafter(true); if fillafter true, transformation animation performed persist when finished. defaults false if not set. note applies individual animations , when using animationset chain animations.

ruby on rails 4 - Sidekiq. Send Callback after job Done -

i using sidekiq sidekiq-status check when work done keep performing action. method use not efficient it. controller: myjob = jobcreator.perform_async(my_param) sleep(1) 10.times status = sidekiq::status::get myjob, :job_status if ["ok","fail","nomoney"].include?(status) result << status break end sleep(1) end how can make on more direct, fast , efficient way? the pro version of sidekiq has feature called batches includes ability configure callbacks , fetch status of batch. batches defined collection of jobs, nothing prevents use job in batch. as far know, that's feature supports callback.

excel - Auto filtering a table with a ComboBox -

i have 3 comboboxes populated numbers , trying filter table when following macro called. problem on various tests filters correctly returns blank table blank rows. comboboxes loaded correctly, there rows in table match criteria in test. sub autofilter() worksheets("sheet1").combobox1.value if worksheets("sheet1").combobox1.value <> "" activesheet.listobjects("table").range.autofilter field:=1, criteria1:=number1 if worksheets("sheet1").combobox2.value <> "" activesheet.listobjects("table").range.autofilter field:=2, criteria1:=number2 if worksheets("sheet1").combobox3.value <> "" activesheet.listobjects("table").range.autofilter field:=3, criteria1:=number3 what wrong?

I want to log all mqtt messages of the broker. How should I design schema of database. Avoiding dulplicate entries and fast searching -

i implementing callback in java store messages in database. have client subscribing '#'. problem when # client disconnects , reconnect adds duplicate entries in database of retained messages. if search previous entries bigger tables expensive in computing power. should allot separate table each sensor or per broker. appreciate if suggest me better designs. subscribing wildcard single client anti-pattern. reasons are: wildcard subscribers all messages of mqtt broker. client libraries can't handle load, not when transforming / persisting messages. if wildcard subscriber dies, will lose messages (unless broker queues endlessly you, doesn't work) you have single point of failure in system. use mqtt brokers hardened production use. these more robust single point of failures hand-written clients. (you can overcome sip through clustering , load balancing, though). so solve problem, suggest following: use broker can handle shared subscriptions (like hi

dll - How to translate C++ char** to Delphi? -

i have c++ dll: int __stdcall hello(int numfiles, char **infiles) and don't know how translate char **. tried: function hello(numfiles: integer; infiles: ppchar): integer; stdcall; external 'dll2.dll'; and then: files: array of pchar; begin setlength(files, 2); files[0] := pchar('siema.jpg'); files[1] := pchar('siema2.jpg'); c := hello(2, @files[0]); but "access violation" on face of it, given information in question, code seems fine. however, rookie mistake, made many beginners interop, believe function's signature enough define interface. not. instance, parameter of type char** used many different things. so, specify information must specify semantics of parameters, not syntax. given int __stdcall hello(int numfiles, char **infiles) let assume following: the return value error code, 0 indicating success. the first parameter number of files. the second parameter array of files, of length s

Change Implementation of Select, Update, and Insert in SQL Server -

to give question first: want know if possible create stored procedure or in sql server intercepts , translates select, insert, , update commands. explanation: i writing web application replace old desktop app. business app database interface reports , searches , ol' crud. new , old apps need live in harmony since customers may using old , new access same db. my problem original database format stores data in single blob of text (1 nvarchar(max) field). want add functionality search on fields stored in blob, cumbersome , slow. update database format without changing desktop app @ all, hence question above. it occurs me on client writing wrapper class data access object , bulk replace in client code reference wrapper, want know options on server well. in case wants know, old app in vb6 , new in c#. edit alright, looks if on server side looking @ adding stored procedures , updating client vb6 code reference stored procs. bulk replace of select sp_oldselect ... return d

java - When to use Android's ArrayMap instead of a HashMap? -

android have own implementation of hashmap, doesnt use autoboxing , somehow better performance (cpu or ram)? https://developer.android.com/reference/android/support/v4/util/arraymap.html from read here, should replace hashmap objects arraymap objects if have hashmaps size below hundreds of records , written to. , there no point in replacing hashmaps arraymaps if going contain hundreds of objects , written once , read frequently. correct? is there reason attempt such replacement? if it's improve performance have make measures before , after replacement , see if replacements helped. probably, not worth of effort.

tvOS AVPlayerViewController Video Info -

in built in apps tvos when watch video shows information video when swipe down. can't find information on how developer can same thing. i'm sure designed possible says "swipe down info" has figured out? i'm using avplayerviewcontroller. thanks. to "info" section show in "swipe down info" pane in avplayerviewcontroller create avmutablemetadataitem s avmetadatakeyspacecommon keyspace , of following keys: avmetadatacommonkeytitle avmetadatacommonkeydescription avmetadataitunesmetadatakeycontentrating avmetadataquicktimemetadatakeygenre and add them avplayeritem 's externalmetadata array. in order each avmutablemetadataitem show must @ least set identifier , extendedlanguagetag , , value properties. here's example: let mediaitem = avplayeritem(url: mediaurl) let titlemetadataitem = avmutablemetadataitem() titlemetadataitem.locale = nslocale.currentlocale() titlemetadataitem.key = avmetadatacommonkeytitle titlemetada

java - Reading keyboard input inside while loop -

this question has answer here: closing scanner throws java.util.nosuchelementexception 1 answer scanner skipping nextline() after using next(), nextint() or other nextfoo()? 14 answers im trying simple menu system, giving me "nosuchelementexception". when press option 1, executes well, when call option 2 asks me "w" , exception thrown. i've tried adding if (sc.hasnext) saw on post , after call option 2, keeps looping , doesn't let me type value x. public main() { int x = 5; scanner sc = new scanner(system.in); while(x != 0) { system.out.println("########## mt ###########"); system.out.println("# 1 - read mt #"); system.out.println("# 2 - read w #");