Posts

Showing posts from 2014

php - Convert json to array in jquery -

i'm trying convert json object array. i've saw many questions on didn't me. my php code : $arr = array ( [1] => 10 [5] => 20 ) //array key random i want assign above array jquery variable. jquery code : var obj = '<?php echo json_encode($arr)?>'; when print obj gives me {"1":"10","5":"20"} . want result in array [1:10,5:20]. and after want access array values key (e.g. obj[1] or obj[5] ) ignore syntax error. thanks. you need define var obj without usage of ' in script <script> var obj = <?php echo json_encode($arr)?>; alert(obj[1]);// alert 10 </script>

Match array key with array value PHP -

how match array key array value. array_intersect() match key array. how match key in first array value in second array. for example array: $value_array=array( '1'=>'text one', '2'=>'text two', '3'=>'text three', '4'=>'text four', '5'=>'text five', '6'=>'text six', '7'=>'text seven', '8'=>'text eight', '9'=>'text nine', '10'=>'text ten' ); $key_array=array( '1'=>'1', '2'=>'2', '3'=>'4', '4'=>'5', '5'=>'7' ); if use array_intersect() , use match key. want search key array , value array. , output show this: array ( [1] => text 1 [2] => text 2 [3] => text 4 [4] => text 5 [5] => text 7 ) i got answer, here : print_r(array

node.js - How to read binary files in node js -

i trying fetch content of binary file in binary format. think doing wrong. can help? code sample var fs = require('fs'); fs.open('public/abc.bin', 'r', function(status, fd) { if (status) { console.log(status.message); return; } var buffer = new buffer(100); fs.read(fd, buffer, 0, 100, 0, function(err, num) { response['msg'] = buffer.tostring('utf-8', 0, num); res.json(response); }); });

vb.net - Calculating Totals From Previous Entries VB -

so i'm trying calculate total amount of account adding or subtracting amount user places in amounttextbox depending on (deposits added account total, checks subtracted, , service charges subtracted). however, when go in visual studio 2010 (since that's program i'm required use), amounts subtracted types show negative , not subtracted total. isn't creating total of deposit , subtracting that; it's subtracting 0 , adding zero. know code wrong, have no idea how fix or write fix it. need if/else statements in order correct. public class form1 private sub clearbutton_click(byval sender system.object, byval e system.eventargs) handles clearbutton.click 'clear textboxes , total variable amounttextbox.clear() totaltextbox.clear() end sub private sub exitbutton_click(byval sender system.object, byval e system.eventargs) handles exitbutton.click 'close program me.close() end sub private sub printbutton_click(byval sender system.object, b

ios - Push registration and receiver methods static library -

i need create static library in objective-c have push registration , receiver methods in it. library replicating appdelegate functionality , minimizes coding effort in app. possible implement push notification inside static library? eg:- urbarnairship , mixpanel plz share code reference or tutorials no push notification requires apns certificate not possible in static library .

.net - Making sure to always run the dnvm and dnu commands by adding to .bash_profile -

i following along installing asp.net 5 , dnx post , here i'm stuck: tip : add following .bash_profile , restart terminal. first line ensure can run dnvm , dnu commands. second line works around known bug in mono may see ioexception filesystemwatcher has reached maximum number of files watch when running application. source dnvm.sh export mono_managed_watcher=disabled my simple question is: how add .bash_profile ? .bash_profile file sits @ ~/ . should able open text editor , add commands. alternatively can in terminal. echo 'source dnvm.sh' >> ~/.bash_profile echo 'export mono_managed_watcher=disabled' >> ~/.bash_profile whats happening here appending piece of text 'source dnvm.sh' specific file. the echo command prints text, , >> shift operator appends text file .bash_profile located @ ~/ .

javascript - How to populate the textbox -

this idea. for instance, have on list namelist = [ { 'id': 1 , 'name': "fred" }, { 'id': 2 , 'name': "dale" }, { 'id': 3 , 'name': "denmark" } ] and have on template for example: name: <input type='text' name='name'> id: <input type='hidden' name='id'> what want here that, whenever type name 'fred' in first textbox, automatically,the id become 1. if type 'dale', become 2. reason want kind design want id saved database. think need use javascript not have idea how it. please... appreciated. thank in advance don't have enough reputation comment posting answer not sure want. if looking auto-complete type input type , gives suggestion , select 1 of suggestions below example can you. here have flexibility want show user , want use value later on can save in db. https://jqueryui.com/autocomplete/ http://demos.jquerymobile.

ftp client - Saving base64String as image on FTP server, saves corrupted file -

saving base64string image on ftp server saving corrupted file. doing following things converted base64string byte[]. initialized memorystream byte converted in above step. opened stream ftp write stream on ftp. below code public bool writefrombase64tofile(string base64, string path, string filename) { bool result = false; using (ftpclient ftp = new ftpclient()) { // setting ftp properties required values. ftp.readtimeout = 999999999; ftp.host = host; ftp.credentials = new system.net.networkcredential(username, password); ftp.port = convert.toint32(port); ftp.dataconnectiontype = ftpdataconnectiontype.autopassive; ftp.connect(); ftp.connecttimeout = 1000000; // converting base64string byte array. byte[] file = convert.frombase64string(base64); if (ftp.isconnected) { int buffer_size

postgresql - Different effects of ORDER BY clause on two servers -

my query: select * table group id; id field primary key, of course; in 9.4.4 expected error: column "table.name" must appear in group clause or used in aggregate function but! in 9.4.5 works, in mysql. can tell me - why? :) postgres version not matter here. tables not identical. in 9.4.5 table column id primary key, while in 9.4.4 not.

how can make use response of multidimentional array in ajax that response in php but use in javascript -

this response of ajax array ( [0] => array ( [name] => shoaib [description] => shoaib frontend developer ) [1] => array ( [name] => jawad [description] => jawad teacher ) ) above shown in console.log() how can handle in javascript to use response ( multi-dimensional array ) php script in javascript use json_encode $arr=array(); $arr[]=array('name'=>'shaoaib'); $json=json_encode( $arr ); header('content-type: application/json' ); echo $json;

osx - OpenCL: how to optimise a reduction kernel (summation of columns), currently the CPU is faster -

Image
i have started use opencl first time , i'm trying optimise reduction kernel. kernel take square grid of floating point numbers (the data represents luminance value of greyscale image) of size width-by-length pixels. kernel sums along every column , returns total each column output array. /* input -- "2d" array of floats width * height number of elements output -- 1d array containing summation of column values width number of elements width -- number of elements horizontally height -- number of elements vertically both width , height must multiple of 64. */ kernel void sum_columns(global float* input, global float* output, int width, int height) { size_t j = get_global_id(0); float sum = 0.0; int i; for(i=0; i<height; i++) { sum += input[i + width*j]; } output[j] = sum; } opencl should make perform every column summation in concurrently because set global dimensions number of columns in data. have used instruments.app

c++ - Using boost preprocessor to call a variadic template iteratively -

assume have variadic template: template<typename... args> class foo; this variadic template generates template recursively until reaches 1 argument foo in last level. want have macro example bar(...) when call this: bar(float, int, string, vector<int>) // expands macro(foo<float, int, string, vector<int>>) macro(foo<int, string, vector<int>>) macro(foo<string, vector<int>>) macro(foo<vector<int>>) which macro(...) macro doing on class. hope able use boost preprocessor reduce code have write. please suggest me tips helps me write such macro. i don't know if best approach solving problem want: #include <boost/preprocessor/repetition/repeat_from_to.hpp> #include <boost/preprocessor/seq.hpp> #include <boost/preprocessor/variadic/to_seq.hpp> #define call_macro(_,__,seq) macro(foo<boost_pp_seq_enum(seq)>) #define generate_macro_invocations(seqs) boost_pp_seq_for_each(call_mac

javascript - CGI Response and AngularJS ng-model -

i have problem getting equivalent timezone assigned in model. in question below, value of model timesetting.timezone 34 cgi response. how call respective timezone value assigned 34 in dropdown list value displayed in input box? there immes associated plunker in answer part of other question. <body ng-controller="mainctrl"> <select class="select len_lg" ng-model="timezone"> <option value="1">(gmt-12:00) international data line west; </option> <option value="2">(gmt-11:00) utc-11; </option> <option value="3">(gmt-11:00) samoa;</option> <option value="4">(gmt-10:00) hawaii;</option> <option value="5">(gmt-09:00) alaska; </option> <option value="6">(gmt-08:00) baja california;</option> <option value="34">(gmt-08:00) pacific time (us &amp; canada);</option>

windows - How to call MmGetPhysicalMemoryRanges in driver to get memory range? -

i writing driver in want exact range of ram. came know memory manager routines inside windows kernel. planning include mmgetphysicalmemoryranges routine in driver memory range. don't know how add these routines driver.. please tell me how write routine??what syntax??? ntkernelapi pphysical_memory_range mmgetphysicalmemoryranges ( void ); where physical_memory_range is: typedef struct _physical_memory_range { physical_address baseaddress; large_integer numberofbytes; } physical_memory_range, *pphysical_memory_range;

c# - Trying to update a text file -

i'm trying replace line in .txt file when click update button this program looks http://i.imgur.com/hku4bgo.png this code far string[] arrline = file.readalllines("z:/daniel/sortedaccounts.txt"); arrline[accountcombobox.selectedindex] = "#1#" + firstnameinfobox.text + "#2#" + lastnameinfobox.text + "#3#" + emailinfobox.text + "#4#" + phonenumberinfobox.text + "#5#email#6#"; file.writealllines("z:/daniel/sortedaccounts.txt", arrline); this what's inside sortedaccounts.txt #1#bob#2#smith#3#bob@smith.com#4#5551234567#5#email#6# #1#dan#2#lastyy#3#daniel@lastyy.com#4#5551234567#5#email#6# the combobox in order txt file. so same index selected item in combobox. , want delete line , add new line same txt file updated information. my code isn't doing reason though , can't figure out try out using list remove entry @ index. don't forget reload comb

java - asprise ocr maven build fail? -

i have maven project in using asprise ocr - dependency: <dependency> <groupid>com.asprise.ocr</groupid> <artifactid>java-ocr-api</artifactid> <version>[15,)</version> </dependency> when im trying build executable jar file failed - no matter project if dependency exist in pom couldnt build jar file? error output: [error] failed execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single (default-cli) on project pdfjsonconverter: execution default-cli of goal org.apache.ma ven.plugins:maven-assembly-plugin:2.2-beta-5:single failed. illegalargumentexception -> [help 1] org.apache.maven.lifecycle.lifecycleexecutionexception: failed execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single (default-cli) on project pdfjsonconver ter: execution default-cli of goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single failed. @ org.apache.maven.

c# - Context Menu not showing when pressing Shift+f10 in GridView Column -

i have listview consist of gridview xaml <window x:class="gridviewcontextmenu.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:gridviewcontextmenu" mc:ignorable="d" title="mainwindow" height="350" width="525"> <window.resources> <contextmenu x:key="dynamicperiodcontextmenu" background="{dynamicresource {x:static systemcolors.windowbrushkey}}" datacontext="{binding path=placementtarget.datacontext, relativesource={relativesource self}}"> <menuitem header="open" /> <menuitem header="

email - how to read lines start with string : Err from a text file and mail it to the recipients using JAVA -

i have error log text file now read lines start text err ,and store in string array using java mail content of string array read my piece of java code: mimemessage message = new mimemessage(session); string pathlogfile = "d:/logfile.log"; enumeration enumeration = carparser1.logger.getrootlogger().getallappenders(); while ( enumeration.hasmoreelements() ){ appender appender = (appender) enumeration.nextelement(); if ( appender instanceof fileappender ){ pathlogfile = ((fileappender)appender).getfile(); //here path break; } } stringbuffer sb = new stringbuffer(); fileinputstream fstream = new fileinputstream(pathlogfile); bufferedreader br = new bufferedreader(new inputstreamreader(fstream)); string singleline; while ((singleline = br.readline()) != null) { sb.append(single

Excel add-in using JavaScript API - how to get chart series source? -

i writing excel add-in using ms office javascript api one of tasks store charts in cloud , recreate them later. creating chart, function api providing var chart = ctx.workbook.worksheets.getitem(sheetname).charts.add("pie", sourcedata, "auto"); where sourcedata must excel range in a1:b2 format. unfortunately, when iterate through charts in sheet, series object contains values, no reference range provided. in original vba excel model , series class had additional formula property, missing js implementation. do have idea how solve ? how series range chart ? maybe provide 'sourcedata' range follows. var sheet = ctx.workbook.worksheets.getactiveworksheet(); var sourcedata = sheet.getrange("a1:b6"); var chart = ctx.workbook.worksheets.getitem(sheetname).charts.add("pie", sourcedata, "auto"); placing directly string "a1:b6" not seem work.

javascript - bootstrap carousel not working in firefox -

in site there issue on carousel slider , it's working on chrome, not working on mozilla my live site url is: http://www.umzug-preise.com/home i have used code below. <header id="mycarousel" class="carousel slide"> <!-- indicators --> <ol class="carousel-indicators"> <li data-target="#mycarousel" data-slide-to="0" class="active"></li> <li data-target="#mycarousel" data-slide-to="1"></li> <li data-target="#mycarousel" data-slide-to="2"></li> </ol> <!-- wrapper slides --> <div class="carousel-inner"> <div class="item active"> <!-- set first background image using inline css below. --> <div class="fill" style="background:url(images/slider

python - Warning in file statement -

i getting warning : assignment reserved built-in symbol: file on comand: file=open(filename,'r') any specific reason? file built-in global name in python. it's warning not redefine it.

In Java is it possible to check at runtime on which subclass a method was called? -

interface y { void search(string name); } class implements y { void search(string name) { //is possible say: "if called class b search("b"); } } class b extends { } public class main { public static void main(string[] args) { b b = new b(); b.search(); } } given above code possible reason in superclass subclass used calling method? the reason want because code in search similar subclasses, thing changes classname, thought there no need override in each subclass. have updated code reflect this. please let me know if there better way of doing it/ calling this.getclass() inside search method give concrete class of current instance. for example: class example { static class { public void search() { system.out.println(getclass()); } } static class b extends {} public static void main (string[] args) throws java.lang.exception { new a().search(); new b().sea

smartface.io - File Download Smartface 4.5 -

i have downloaded sample project file upload , download not work file download ios , android. bug still going on relase also? if not share working code picture download sample code? you can use following codes file download.it works fine me.also, can reach sample codes guides . var webclientdownload = new smf.net.webclient({ url : "http://services.smartface.io/file/download/javascript.js", httpmethod : "get", autofilesave : true, onsyndicationsuccess : function (e) { alert("downloaded javascript.js"); }, onservererror : function (e) { alert("an error occured"); }, responsehandling : smf.net.responsehandling.forcefile }); function page1_cntdownload_onpressed(e) { webclientdownload.run(); }

java - How to build OSGi(Equinox) project from command line -

i have osgi(equinox) project. , have required osgi plugin jars in directory. want build project using command line. in fact, have 2 osgi project , , b. depending on b , depending on other plugins. want build a. actually project building in eclipse defined target platform targeting plugin directory. use maven , tycho. there tycho tutorial started.

amqp - SimpleAmqpClient & rabbitmq-c binaries -

are there pre-built per-platform binaries amqp libraries simpleamqpclient & rabbitmq-c (and if no, reason)? you expected build source. open source sites not allow binaries directly distributed, there matter of choosing own optimizations during compile time. also, simpleamqpclient c++ , generated binaries toolchain specific.

php - Magento 2 - Empty custom widget render -

i try create custom widget on magento 2 ee list products custom attribute 'end_life' yes/no type. it's ok in backoffice, created widget type "end life products" , inserted on homepage. but render on homepage empty. <p></p> please me render products list :) app/code/my/custommodule/etc/module.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="../../../../../lib/internal/magento/framework/module/etc/module.xsd"> <module name="my_custommodule" setup_version="1.0.0"> </module> </config> app/code/my/custommodule/etc/widget.xml <?xml version="1.0" encoding="utf-8"?> <widgets xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="../../../magento/widget/etc/widget.xsd"> <widget id="my_custommodule_

vba - Cut & Paste Overwriting Range Object definitions -

i've found interesting problem excel vba's cut , paste involving use of defined range object. here's code doesn't work: sub pastetorangedoesntwork() dim strng range dim j, k, x, y integer set strng = range("a3") x = 0 j = range(strng, strng.end(xltoright)).columns.count k = worksheetfunction.max(range(strng, strng.end(xldown))) y = 1 k while strng.offset(x, 0) = y x = x + 1 wend if y < k range(strng.offset(x, 0), strng.end(xldown).offset(o, j - 1)).select selection.cut set strng = strng.offset(0, j + 1) activesheet.paste destination:=strng x = 0 end if next y end sub the problem when pasting defined strng , strng object disappears , becomes , undefined object. there's simple fix, i've done below. sub pastetorangeworks() dim strng range dim j, k, x, y integer set strng = range("a3") x = 0 j = range(strng, strng.end(xltoright)).columns.count k = worksheetfuncti

javascript - after removing radio button selected value from js in aspx.cs selected value presists -

i have asp radio button list control below: <asp:radiobuttonlist id="radio2" runat="server" enableviewstate="false"> <asp:listitem text="yes" value="0"></asp:listitem> <asp:listitem text="no" value="1" selected="true"></asp:listitem> </asp:radiobuttonlist> <asp:button id="btnsubmit" runat="server" text="submit" onclick="btnsubmit_click" /> when page loads on browser select yes option radio. console remove checked property of this: $("#radio2 input[type='radio']").prop("checked",false); now if try access radio button list on click of button submit below protected void btnsubmit_click(object sender, eventargs e) { foreach (listitem itemrow in radio2.items) { if (itemrow.selected)

php - How to fetch all the urls which are not linked using regex -

i need fetch urls given string not linked(url without anchor tag). i know regex (http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])? fetch urls given string. input: <div class='test'> <p>heading</p> <a href='http://www.google.com'>google</a> www.yahoo.com http://www.rediff.com <a href='http://www.overflow.com'>www.overflow.com</a> </div> output: www.yahoo.com http://www.rediff.com kindly advise. use library dom tree html, , links. example can use simplehtml http://simplehtmldom.sourceforge.net/ // create dom url or file $html = file_get_html('http://www.google.com/'); // find links foreach($html->find('a') $element) { echo $element->href . '<br>'; }

video streaming - Android MediaProjection screen mirroring to Web browser over USB -

i want mirror android screen desktop web browser. able capture screen using mediaprojection - sample app. but next part hard 1 - sending captured data desktop! know technique establish http connection desktop program adb port forwarding guess fps low. how can stream captured screen data desktop? sort of connection need , codecs need on android side ensure speed? thanks

javascript - Unable to find module: react-accordion component -

i making accordion in react-native.i have taken following steps: 1) in react-native project have install react-accordion-component using following commond: npm install --save react-accordion-component 2) import index.android.js : 'use strict'; import react, { appregistry, component, stylesheet, proptypes, toastandroid, touchableopacity, viewpagerandroid, text, view } 'react-native'; import { tab, tablayout } 'react-native-android-tablayout'; import 'react-accordion-component'; class poc extends component { constructor(props) { super(props); this.state = { pageposition: 0, }; } render() { var accordion = require('react-accordion-component'); var elements = []; elements.push({ title: 'element 1', onclick: function() { alert('hello world!') }, content: 'lorem ipsum...' }); elements.push({ title: 'element 2', onclick: function(

Facebook graph API does not provide all taps list -

facebook graph api provides 3 tabs. 1 photos 2 likes 3 videos graph api not provide other taps ex : timeline,others.. api call : /v2.5/{page-id}/tabs not sure question is, i´ll try answer anyway: "timeline" not installable tab, makes sense not show up. can sure there timeline, don´t need information. the rest depends on installed tabs, "photos", "likes" , "events" 1 of pages don´t have video tab 1 events. custom tabs (page apps) should show up. if don´t, should file bug.

java - Custom JSON ObjectMapper : no matching editors or conversion strategy found -

i trying create custom objectmapper getting issues. want use tostring method of enum used during serialization: xml configuration: <bean id="resttemplatems" class="org.springframework.web.client.resttemplate"> <constructor-arg ref="httpclientfactory" /> <property name="messageconverters"> <list> <bean class="org.springframework.http.converter.json.mappingjacksonhttpmessageconverter"> <property name="supportedmediatypes"> <list> <value>somethio</value> </list> </property> <property name="objectmapper" ref="customobjectmapper"/> </bean> </list> </property> </bean> <bean id="customobjectmapper" class="com.mag.

java - What happens when request comes to Tomcat server? -

when request comes tomcat server, checks web.xml , based on url-mapping, request redirected. okay if tomcat server has 1 application deployed in it. but happens when tomcat server has more 1 application deployed in it? when request comes tomcat server, how knows application has invoke? told me there file called server.xml (or that) provide url-mapping each , every application deploy in server. based on tomcat redirects request particular application web.xml. can please let me know flow of request processing? 1) need place war files tomcat's webapps folder. 2) tomcat expands each war file folder , automatically deploys war files. 3) once applications up, based on request url defined in deployment descriptor, request directed particular application.

eclipse - Adding menu to In E4 MWindow -

in our eclipse e4 (pure e4) application have open new window , show views in new window (which different main window). in new window trying add menu (file->import) pro-grammatically. have written below code new window not showing menus. missing? ` mtrimmedwindow window = mbasicfactory.instance.createtrimmedwindow(); .... mmenu menubar = menufactoryimpl.einstance.createmenu(); menubar.setlabel("test"); window.setmainmenu(menubar); mmenu filemenu = menufactoryimpl.einstance.createmenu(); filemenu.setelementid("file"); filemenu.setlabel("file"); menubar.getchildren().add(filemenu); mmenuitem item1 = menufactoryimpl.einstance.createdirectmenuitem(); item1.setelementid("item1"); item1.setlabel("item1"); filemenu.getchildren().add(item1);` don't add window application children until after have created , setup main menu (and else want have in window). when add window application child list rendered immediately. if

plc - Siemens TIA portal, specifically tags -

i have plc profinet, connected profibus dp slave. plc connected hmi screen. new software , guide came it, doesnt me problem. have tags created various i/o cannot link of tags slave, in io tags tab says, there no io tags display. know how link tags? kind regards firstly less information question, connection make betweeen plc , hmi, assuming have profibus connection as-os compile tags should generated if connection healthy. on hmi (assuming wincc) go tag management , simatic s7 protocol suite under find connection profibus, right click , check system parameter find logical device name. make sure select correct device name combo box. should fixed.

plsql - Cursor and SUBSTR usage in procedure -

i need trim instance name complete dblink name .for example select query returns result hhvisdev.triniti.com. need hhvisdev. , ofcourse there such multiple results. need use cursor , print final result. getting warning: procedure created compilation errors. , when compile. , when call procedure getting error @ line 1: ora-06575: package or function deletedblinks1 in invalid state. can 1 please guide me. create or replace procedure deletedblinks1 cursor mycursor select substr(db_link, 1, instr(db_link, '.', 1, 1) - 1) dba_db_links; myvar dba_db_links.dblinks%type; begin open mycursor; loop fetch mycursor myvar; exit when mycursor%notfound; dbms_output.put_line(myvar); end loop; close mycursor; end; / if see warning: procedure created compilation errors , then, can guess, compile procedure in sql*plus. in sql*plus can run command show errors and see errors list. procedure looks ok, think problem - have no access

c# - ASP.NET MVC Enumerable to delimited HTML in Razor -

this question has answer here: looping through list in razor , adding separator between items 4 answers i discovered can use string.join(", ", string[] enumerable) turn list of strings single comma delimited string. similar produce example list of hyperlinks in razor view? instead of like: @foreach(var item in enumerable) { <a href="@item.url">@item.title</a> if(item != enumerable.last()) { <span>, </span> } } and if so, advisable or should stop being lazy? @html.raw(string.join("<span>, </span>", enumerable.select(item => string.format("<a href=\"{0}\">{1}</a>", item.url, item.title))))

How to handle a single quote in Oracle SQL with long text -

how insert record in column having clob data type(so big text) having single quote in it? i've seen how handle single quote in oracle sql but solution make manual , i'm trying insert long text contains lot of single quotes. once oracle detects ', insert doesn't work. my question if there kind of command "set define off" can tell oracle disable ' in text try q' operator; example: create table t_clob ( clob) insert t_clob values (q'[start aa'a''aa aa 'a'' aa'a' a'a' end]')

codeigniter - How to access non-default view inside view folder in code igniter -

i know how display default view in code igniter. but, how can access other files inside view folder. example want display ' application/views/admin/index.php ' isn't default view. you can add sub folders in view so. $this->load->view('admin/index'); is meaning. codeigniter views file name: example.php <?php class example extends ci_controller { public function index() { $this->load->view('admin/index'); } } folder structure application application / views / application / views / admin application / views / admin / index.php i not choose index.php name view rename name dashboard.php or thing. because have index.php in main directory.

java - How can I store and load my Sessions as a User on Parse? -

i developing android app existing ios app, using session object store data on parse crucial me. as creating , uploading sessions parse have no problems. public static void syncuser() { parseuser.getcurrentuser().fetchinbackground(new getcallback<parseobject>() { @override public void done(parseobject object, parseexception e) { if (e != null) { log.d("", "sync error"); e.printstacktrace(); } if (object != null) { syncsessions(); } } }); } private static void syncsessions() { parsequery<parsesession> query = parsequery.getquery(parsesession.class); query.fromlocaldatastore(); query.findinbackground(new findcallback<parsesession>() { @override public void done(list<parsesession> objects, parseexception e) { (parsesession session : objects) { fetchsession

Python: do variable assignments from the global environment interact with variables inside function definitions? -

this function shows value of variable "a" inside function influenced value of "a" in global environment a=1 def f(x): print(a) return x+a f(3) the output 4 , printed value of 1. understanding of functions in python, global environment separate local environment (inside function), cannot explain why value of 1 inside function. please explain. appreciated. ps: first post on stack overflow, please excuse style of asking if it's not liking.

php - `json_encode` not working with explode -

i have string containing numbers separated comma. ie, 1,2,3,6... . have removed comma using explode. want match corresponding values in database. my code is, $color = "1,2,3,9,5"; $color_split = explode(",", $color); foreach($color_split $item) { $select_color = "select * tbl_product_color color_id = '$item'"; $select_color_q = mysqli_query($c, $select_color) or die(mysqli_error($c)); $length = mysqli_num_rows($select_color_q); if($length > 0) { while($select_color_r = mysqli_fetch_object($select_color_q)) { $var[] = $select_color_r; } $var = json_encode($var); echo '{"color_list":'.$var.'}'; } else { $arr = array('status'=>"notfound"); echo '{"color_list":['.json_encode($arr).']}'; } } now output is, {"color_list":[{"color_id":&qu

.net - Graphics.DrawRectangle Missing edge on 2nd screen -

i'm trying draw variable colour/width border on form (for 'across room' status reporting) draws fine except when maximised on non-primary displays... when maximised on 2nd display don't left edge drawn shown here (green rect added debug, , appears draw ok). i've tried numerous permutations of draw sequence, +/-1 pixel here , there, changing pen properties etc.. nothing seems work , fact works non maximised everywhere , maximised on primary screens makes me think it's bit more subtle. complete code reproduce (single size-able form single button): public class form2 private drawhighlightingrectangle boolean = false private highlightingrectanglecolour color = color.red private sub form1_paint(sender object, e painteventargs) handles me.paint if drawhighlightingrectangle dim mypen new system.drawing.pen(highlightingrectanglecolour, 8) mypen.alignment = drawing2d.penalignment.inset e.graphics.clear(me.backcolor) e.g

parse.com - Unit tests for Parse Cloud Code? -

i have application uses cloud code backend. there way write unit tests parse cloud code? try this: how use unit tests parse cloud code

jQuery toggle based on class -

i need toggle panels , so, i've put togeter small script such as: <div> <div class="ftd ftd_title"><strong>this title</strong></div> <div class="ftd ftd_field">this toggle div</div> <div class="ftd ftd_field">this toggle div</div> <div class="ftd ftd_field">this toggle div</div> </div> jquery(document).ready(function() { $('.ftd_field').hide(); $(".ftd_title").click(function(){ $(".ftd_field").slidetoggle("slow"); }); }); example(1) on codepen: http://codepen.io/vms/pen/vlxeax as long have 1 toggle per page, there no issues. yet, in event of several toggles in 1 page, gets toggled/shown/hidden @ same time can see here "carrots/peppers/apples" example have put together: <div class="ftd ftd_carrots ftd_title"><strong>carrots</strong></div> <div class=&qu

c - Get Ip address function not working well -

i'm trying ip address of server, gets 127.0.1.1 instead of 127.0.0.1. error? how can real ip address, not localhost address. #define maxhostname 256 #define debug char * getipaddress() { char myname[ maxhostname + 1 ]; static char ipinascii[ maxhostname ]; /* oversized */ struct hostent * hp; memset( myname, 0, maxhostname + 1 ); /* init */ memset( ipinascii, 0, maxhostname ); gethostname( myname, maxhostname ); #ifdef debug printf( "hostname %s\n", myname ); #endif /* debug */ hp = gethostbyname( myname ); if( hp == null ) { perror( "gethostbyname" ); return( "ip not found" ); } inet_ntop( hp->h_addrtype, hp->h_addr_list[ 0 ], ipinascii, maxhostname ) ; #ifdef debug printf( "canonical hostname %s @ ip %s\n", hp->h_name, ipinascii ); #endif /* debug */

excel - Pop up calendar for date selection in place of input box -

i using macro, in using input box manually typing date .autofilter 2 lines below. key1 = inputbox("expiry date", "title") .range("a1").currentregion.autofilter field:=2, criteria1:=key1 here need , pop calendar, instead of manually typing date, can choose date calendar. here u can find answer ur question link

c++ - Name lookup issue in trailing return type -

the following example illustrates question: #include <iostream> #include <string> template <typename t> auto func(const t& x) -> decltype(to_string(x)) { using std::to_string; return to_string(x); } int main() { std::cout << func(1); } i don't want import std::to_string global namespace, not want use -> decltype(std::to_string(x)) doing disables adl. obviously, can't put using std::to_string within decltype . so, how should it? defer namespace; namespace activate_adl { using std::to_string; template <typename t> auto func(const t& x) -> decltype(to_string(x)) { return to_string(x); } } template <typename t> auto func(const t& x) -> decltype(activate_adl::func(x)) { return activate_dl:: func(x); } this allows adl still done, doesn't pollute global namespace. having hit issue few times std related functions , adl, i've found deferred namespace (well named) suitabl

visual studio 2012 - NUnit 3.0.1 for C#: how to run a few test from the same class in parallel way -

im using vs2012 + resharper. created nunit test projest (nunit 3.0.1) , added parallelizable attribute test classes. works in parallel way when started classes. when it's started 1 class, runs test one-by-one. im staring tests visual studio's resharper window. how run few tests 1 class in parallel way? as of nunit 3.0 (including 3.0.1) individual tests not yet parallelizable. lowest level of parallelization between testfixtures. if using parallelizable.children - has same functionality parallelizable.fixtures . allowing individual tests run in parallel planned future releases, @ point parallelizable.children attribute want, believe. this documented here .

Multiple entries after storing one single certificate into my Java keystore -

i'm using class installcert import vmware vcenter certificate local java keystore. the line socket.starthandshake() returns unsupportedoperationexception , class savingtrustmanager still has downloaded certificate successfully. then store downloaded certificate local keystore using following snippet. keystore jsk; ... ... .. jks.setcertificateentry(alias, cert); outputstream out = new fileoutputstream("jssecacert"); jks.store(out, passphrase); out.close(); but when try list entries in keystore: keytool -list -keystore jssecacerts -v , shows there 160 entries including 1 have downloaded. i'm pretty sure keystore generated code, , supposed empty. i'd know other 159 entries come ? thanks. use keystoreexplorer comparing both truststores: jssecacerts generated installcert class, , cacerts file located en java>jre>security>lib. istallcert takes certificate server , creates copy of truststore of jvm using. adds certificate copy of t

categories - WordPress - how to overcome category and page permalink clashes -

in wordpress, have category , subcategory: donkey (slug=donkey-category) reports (slug=reports - parent category donkey-category) i have page: donkey (slug=donkey, categorised donkey-category) and have series of posts: my post name 1 (categorised donkey-category , reports) post name 2 (categorised donkey-category , reports) etc. i want page have permalink /donkey i want category index page have permalink /donkey/reports i want each of posts have permalink /donkey/reports/my-post-name-1, etc. but because page called "donkey" , parent categories called "donkey" having give 1 of them different slug , either compromises permalink page or category , posts. i have configured permalink custom structure: /%category%/%postname%/ and have "remove category url" plugin (to avoid /category/donkey-category verbosity)

c++ - Change .exe with hexeditor -

Image
i wrote little program in c++: #include <iostream> int main() { int input; std::cin >> input; if(input == 5){ std::cout << "input == 5"; } else{ std::cout << "input != 5"; } return 0; } i have built program. working program in release folder. want change if statement, without changing c++ code. downloaded hex editor , opened file. inside .exe lot. googled problem , found nice image: i searched inside hex editor output input == 5 . found it. when change different , execute file, program displays new entered message, not old one. but want change structure of code (the if statement). searched if , didn't find anything. so, code section (image)? c++ high-level language. written in "source" (plain text, i.e. if ( ... ) ), , compiler translates machine code. machine code different , low-level language. one, c++ "if ... else", machine code "c

c# - How to find SQL Connection String when VS is not installed on the same server as SQL is -

visual studio installed on computer. doing rdp network computer on sql server installed. need put in connection string per network computer on have required database. know how pick connection string when doing within visual studio, here need retrieve via sql server , copy paste vs. there no magiс in sql server connection string , can construct manually using server name , options. when you're connecting using username , password looks like server=myserveraddress;database=mydatabase;user id=myusername;password=mypassword; when you're using trusted connection (windows authentication) looks like server=myserveraddress;database=mydatabase;trusted_connection=true; have here more details , options concerning sql server connection strings

c# - Unable to read system views in Entity Framework -

i trying execute following query select object_id sys.tables sys.tables.name = 'projects' as int n = context.database.sqlquery<int>( "select object_id sys.tables sys.tables.name = 'projects'") .firstordefault(); i n 0 if use sqlconnection , query using sqlcommand correct results. why dbcontext.database.connection not let me execute plain sql query? for simplicity have removed sqlparameter , aware code not sql injection safe. there no problem system views, entity framework cannot read value types in sqlquery. had change it, public class singlevalue<t>{ public t value {get;set;} } int n = context.database.sqlquery<singlevalue<int>>( "select object_id value sys.tables sys.tables.name = 'projects'") .tolist().select(x=>x.value).firstordefault();

ruby on rails - Trying to change environment variable within RSpec model spec -

i've got 1 user model has different validations based on environmental variable env['app_for']. can either "app-1" or "app-2". app-1 validates username while app-2 validates email address. here user model spec app-1: require 'rails_helper' rspec.describe user, type: :model include shared::categories before env['app_for']='app-1' end context "given valid user" before { allow_any_instance_of(user).to receive(:older_than_18?).and_return(true) } {should validate_presence_of :username} end end and user model spec app-2 require 'rails_helper' rspec.describe user, type: :model include shared::categories before env['app_for']='app-2' end context "given valid user" before { allow_any_instance_of(user).to receive(:older_than_18?).and_return(true) } {should validate_presence_of :email} end end my problem environment variable isn'