Posts

Showing posts from May, 2014

html - Wordpress, where to identify the permalink error? -

i have html code links function.php gets url href. <a href="<?php echo projecttheme_post_new_link(); ?>"><?php echo __("post new",'projecttheme'); ?> originally working url: http://www.wastebidder.com/waste/post-new-project/?post_new_step=1&projectid=949 now link not appear go page , copying url not work! goes 404.php. the html href looks now: <a href>post new</a> the other permalink works fine, need know how able solve it. function part 1 function projecttheme_post_new_link() { return get_permalink(get_option('projecttheme_post_new_page_id')); } i guessing url function: function projecttheme_post_new_with_pid_stuff_thg($pid, $step = 1, $fin = 'no') { $using_perm = projecttheme_using_permalinks(); if($using_perm) return get_permalink(get_option('projecttheme_post_new_page_id')). "?post_new_step=".$step."&"

c# - Make MVC not post back one of the members in the model which is an interface -

i have view model looks this: class myviewmodel { public string stuff { get; set; } public ifoo foo { get; set; } } the requests work fine because supply both, stuff , ifoo view. however, when posting back, mvc says can't make object of interface. now, have 2 options: a) change type of foo property concrete implementation, no big deal; or b) model binding myself, overkill want. don't care posting ifoo member. how tell mvc not post ifoo? don't have html controls representing ifoo . properties ifoo , use hidden thingies in view. you can exclude properties binding. via model [bind(exclude="foo")] class myviewmodel { public string stuff { get; set; } public ifoo foo { get; set; } } via action [httppost] public actionresult mygreataction([bind(exclude="foo")]myviewmodel model) { }

How do I require my Visual Studio published application to run as administrator? -

is there option in application properties ? cannot find tells visual studio application need run in elevated state. if you're trying on development machine, could: log in administrator , run visual studio -or- right-click visual studio shortcut , click "run as" , supply administrator account credentials. if application developing live on server server cannot left logged in administrator while application runs, should either: build in impersonation code of application, run whatever account want run under give account administrator privileges (if allowed) or choose account has desired privileges windowsimpersonationcontext. info on impersonation: msdn windows impersonation code code project example stackoverflow impersonation question/example without information app, i.e. if web app or standard exe or sharepoint web page, it's hard give more specific info. .net web apps, ensure use windows authentication , set app pool run under account a

symfony - Unable to override KnpMenuBundle template -

with ...mybundle\resources\views\menu\knp_menu.html.twig , deleting </li> has no effect on rendered menu. (removing tag done remove space between inline list elements.) have followed advice provided in this answer , including {% import 'knp_menu.html.twig' knp_menu %} mentioned toward bottom of post. because knp_menu.html.twig extends knp_menu_base.html.twig ? or what? layout.html.twig: ... {{ render(controller('volvolbundle:default:usermenu')) }} ... usermenuaction: $user = $this->getuser(); $tool = $this->container->get('vol.toolbox'); $type = $tool->getusertype($user); return $this->render( 'volvolbundle:default:usermenu.html.twig', array('type' => $type) ); usermenu.html.twig ... {% if type not null %} {% set menu = "volvolbundle:builder:"~type~"menu" %} {{ knp_menu_render(menu) }} {% endif %} the answer found deep in here . that's required

Dynamically add Items to Combobox VB.NET -

i have 2 combobox in windows application. want programmatically add items second combobox based on selected in first combobox. this in selected index change of combobox: private sub combobox1_selectedindexchanged(sender object, e eventargs) handles combobox1.selectedindexchanged try if combobox1.selectedindex = 0 combobox2.items.add("mm") combobox2.items.add("pp") elseif combobox1.selectedindex = 1 combobox2.items.add("sms") elseif combobox1.selectedindex = 2 combobox2.items.add("mms") combobox2.items.add("ssss") end if catch ex exception end try end sub it works fine, however, if keep selecting different items it's keep adding value on , over. add values once. also, when add item prefer add id item description. tried: combobox2.items.add("ssss", "1") it seems it's not working. any sugge

Android How to hide notification bar -

i have been trying hide notification bar, making app full screen: i have tried few sample codes not work, there were: 1# android:theme="@android:style/theme.holo.noactionbar.fullscreen" 2# requestwindowfeature(window.feature_no_title); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); setcontentview(r.layout.activity_main); see below logcat errors:... here code, help: mainactivity import android.os.bundle; import android.support.v4.app.fragment; import android.support.v7.app.actionbar; import android.support.v7.app.actionbaractivity; import android.view.menu; import android.view.menuitem; public class mainactivity extends actionbaractivity { public static final string tag = mainactivity.class.getsimplename(); actionbar actionbar; // declare tab variable actionbar.tab tab1, tab2, tab3; fragment fragmenttab1 = new fragmen

installation - compile errors trying to build Apache Xerces in java -

i trying build apaches xerxes 2.11.0 in java , running following compile errors: [xjavac] c:\program files\java\libraries\xerces-2_11_0\build\src\org\apache\html\dom\htmlframeelementimpl.java:28: error: htmlframeelementimpl not abstract , not override abstract method getcontentdocument() in htmlframeelement [xjavac] public class htmlframeelementimpl [xjavac] ^ [xjavac] c:\program files\java\libraries\xerces-2_11_0\build\src\org\apache\html\dom\htmliframeelementimpl.java:28: error: htmliframeelementimpl not abstract , not override abstract method getcontentdocument() in htmliframeelement [xjavac] public class htmliframeelementimpl [xjavac] ^ [xjavac] c:\program files\java\libraries\xerces-2_11_0\build\src\org\apache\html\dom\htmlobjectelementimpl.java:28: error: htmlobjectelementimpl not abstract , not override abstract method getcontentdocument() in htmlobjectelement [xjavac] public class htmlobjectelementimpl [xjavac] ^ any thou

c# - getting string and numbers -

i got string string newstring = "[17, appliance]"; how can put 17 , appliance in 2 separate variables while ignoring , , [ , ] ? i tried looping though loop doesn't stop when reaches , , not mention separated 1 & 7 instead of reading 17. this may not performant method, i'd go ease of understanding. string newstring = "[17, appliance]"; newstring = newstring.replace("[", "").replace("]",""); // remove square brackets string[] results = newstring.split(new string[] { ", " }, stringsplitoptions.removeemptyentries); // split string // if string going contain 1 number , 1 string: int num1 = int.parse(results[0]); string string1 = results[1]; you'd want include validation ensure first element indeed number (use int.tryparse ), , there indeed 2 elements returned after split string.

gnuplot - How to remove palette colors heatmap -

is possible if heatmap palette(small rectangle on right) removed? this data b c 1 181 80 121 10 34 20 2 18 20 17 20 13 20 3 12 20 5 30 20 20 this gnuplot script set term pos eps font 20 unset key set nocbtics set palette rgbformulae -7, 2, -7 set title "faults" set size 1, 0.5 set output 'heatmap2.eps' ytics="`awk 'begin{getline}{printf "%s ",$1}' 'data2.dat'`" xtics="`head -1 'data2.dat'`" set [i=1:words(xtics)] xtics ( word(xtics,i) i-1 ) set [i=1:words(ytics)] ytics ( word(ytics,i) i-1 ) set [i=1:words(xtics)] xtics ( word(xtics,i) 2*i-1 ) plot "<awk '{$1=\"\"}1' 'data2.dat' | sed '1 d'" matrix every 2::1 w image, \ '' matrix using ($1+1):2:(sprintf('%d', $3)) every 2 labels i want remove palette because adjust ploting colors percentage of data. so, guess palette on right table use anymore. tha

recursion - python recursive in multiple dict -

i have problem multiple dict in recursive , origin non-recursive code mylist = (["aa","bb","cc","dd"]) tempdict = dict() n = len(mylist) j in range(0 , n ): if j == 0: if mylist[j] not in tempdict: tempdict[mylist[j]] = "1" if j == 1: if mylist[j] not in tempdict[mylist[0]]: tempdict[mylist[0]] = dict() tempdict[mylist[0]][mylist[1]] = "1" if j == 2: if mylist[j] not in tempdict[mylist[0]][mylist[1]]: tempdict[mylist[0]][mylist[1]] = dict() tempdict[mylist[0]][mylist[1]][mylist[2]] = "1" if j == 3: ....... if j == 4: ....... if j == n: ....... print tempdict result : {'aa' {'bb': {'cc': {'dd': '1'}}}} , work when need build multiple key dict(). , impossible list all. refine code in recursive function def rfun(tmpdict, mylist, idx, list

java - ManyToMany in javax.persistence allow duplicate entries -

i have table called order has many items , need map link items order . at moment have this: @manytomany(cascade = cascadetype.all, fetch = fetchtype.eager) @fetch(value = fetchmode.subselect) @jointable(name = "order_map_item", joincolumns = @joincolumn(name = "orderid"), inversejoincolumns = @joincolumn(name = "itemid")) list<item> items = new arraylist<item>(); but doesn't allow duplicates if want add item twice. when edit mysql database hand , remove index, can add duplicates. getting more if call em.refresh(order); please tell me, best practice case? can't find anything... looks problem join table has composite primary key each column foregn key both tables. use case dictates there may repetition. in case, alternate strategy mapping entity @entity public class orderitemmapping { @generatedvalue(strategy = generationtype.auto) private long id; @manytoone @joincolumn(name=

sql - I have 4 tables in MySQL - Join with 4th table without duplicates (possible null value) -

ok working 4 tables , need query return no duplicates , null value if needed. unfortunately due restriction in framework using can not use union. here tables: users table ------------------------------------------------------ id name ------------------------------------------------------ 1 jane 2 john 3 skip songs table ------------------------------------------------------ id artist title ------------------------------------------------------ 1 devo whip 2 snake hiss 3 america great 4 elvis blues song_history table ------------------------------------------------------ singer_id song_id ------------------------------------------------------ 2 1 2 2 2 3 2 4 song_current table ------------------------------------------------------ singer_id song_id event_id ------------------------------------------------------ 2 3 20 2 4 22 i have writt

javascript - Sinon.js, QUnit, and Jquery. Attempting to verify posted data through FakeXMLHttpRequest -

i have following qunit test case, attempting verify posted data sent through jquery ajax request: test("ajax tests", function () { var xhr = sinon.usefakexmlhttprequest(); var requests = sinon.requests = []; xhr.oncreate = function (request) { requests.push(request); }; var callback = sinon.spy(); var mockdata = {mockdata: "dummy content"} $.ajax('/some/article', { success: callback, data: mockdata, method: 'post' }); equal(sinon.requests.length, 1); equal(sinon.requests[0].url, "/some/article"); equal(json.parse(sinon.requests[0].requestbody).mockdata, mockdata) }); the json.parse fails, because request body formatted as: mockdata=dummy+content because of how data encoded (spaces replaced + symbol), makes decoding content, , subsequently making json parseable difficult. the end goal dynamically verify request data, using fake xhr object. prefer on mocking jquery post or ajax

javascript - how to add css in css file dynmically? -

i have written js grid. gird have feature taking each column width in input this. mygrid._struct = [{ fieldtype : "deltahedgetype", defaultwidth : 80}, { fieldtype : "quoteccy", defaultwidth : 40 }] so grid html generate this <table id="mygrid"> <tr> <td class="deltahedgetype"></td> <td class="quoteccy"></td> </tr> <tr> <td class="deltahedgetype"></td> <td class="quoteccy"></td> </tr> </table> i want css append in style.css #mygrid .deltahedgetype{ width:40; } #mygrid .quoteccy{ width:80; } what come in mind append css in header in tag. coz ie browser have limitation of count , increase html size of page. how append css in style.css. you have parse mygrid._struct fieldtype , defaultwidth , each eleement use following code the final javascript add css var styl

javascript - Break the string into two lines -

i want break string 2 lines, line should not break two, @ half of word. how can this? the string format this: var words="value.eight.seven.six.five.four.three" expected output is: "value.eight.seven. six.five.four.three" try this: var words="value.eight.seven.six.five.four.three" var wordsarr = words.split("."); var line1 = wordsarr.slice(0,math.floor(wordsarr.length/2)).join("."); var line2 = wordsarr.slice(math.floor(wordsarr.length/2)).join("."); here working fiddle: http://jsfiddle.net/6xgs2/

ios - How to set view controller inside the scrollview? -

my requirement set multiple view controller in scrollview. in viewcontroller1's nib file add scrollview subview , make outlet named myscrollview.and set delegates too.then on scrollview add uiview subview , make outlet contentview. create property viewcontroller named yourviewcontroller (it should have nib file same name). @property (nonatomic, strong) yourviewcontroller *yourviewcontroller; in viewdidload of viewcontroller1 self.yourviewcontroller = [yourviewcontroller alloc] initwithnibname:@"yourviewcontroller" bundle:nil]; [self addchildviewcontroller:self.yourviewcontroller];// viewcontroller going add. self.yourviewcontroller.view.frame = self.contentview.bounds; [self.contentview addsubview:self.yourviewcontroller.view]; [self.yourviewcontroller didmovetoparentviewcontroller:self];

How to split file with a trick in bash -

i have 2 question in split command: 1) how can split huge file in format? x0 x1 . . . x10 . . . 2) how can split huge file in format? 0 1 . . . 10 . . . 100 . . . what tried not satisfactory because result is: x00 x01 x02 . . . x10 . . . x100 . . . thank you first question: >> ls file >> split -a 1 -d file >> ls file x0 x1 x2 x3 ... however, get split: output file suffixes exhausted with method if there more 9 split files. can use >> split -d file >> ls file x00 x01 x02 ... and use rename : >> rename 's/^x0/x/' x0* >> ls file x0 x1 x2 ... second question: use split -a 1 -d file '' if have less 10 split files. otherwise, use split -d file '' and rename 's/^0//' 0*

eclipse - maven android error reading file source.properties -

i trying build simple hello world android app. getting error: failed execute goal com.jayway.maven.plugins.android.generation2:android-maven- plugin:3.9.0-rc.2:generate-sources (default-generate-sources) on project ndbc: execution default-generate-sources of goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.9.0-rc.2:generate- sources failed: error reading /storage/code/android-ndbc/ndbc/~/android-sdks/tools /source.properties -> [help 1] i using maven 3.2.1 here pom: <dependencies> <dependency> <groupid>com.google.android</groupid> <artifactid>android</artifactid> <version>4.1.1.4</version> <scope>provided</scope> </dependency> </dependencies> <build> <finalname>ndbc</finalname> <pluginmanagement> <plugins> <plugin> <groupid>com.jayway.maven.plugins.

ruby on rails - Nested form accepts_nested_attributes_for giving dynamic Array - Rails4 -

i working on rails4 nested form, accepts_nested_attributes_for can able generate nested form giving dynamic array the form when inspect form. <input type="text" name="event_venue[event_contact_details_attributes][1403763304978][name]" id="event_venue_event_contact_details_attributes_1403763304978_name" class="form-control"> but should be, <input type="text" name="event_venue[event_contact_details_attributes][1][name]" id="event_venue_event_contact_details_attributes_1_name" class="form-control" > <div class="formwrapper"> <div class="col-md-6"> <div class="form-group"> <label for="exampleinputemail1">name</label> <input type="text" name="event_venue[event_contact_details_attributes][1403764358820][name]" id="event_venue_event_contact_details_attributes_1403764358820_na

c# - asp.net FileUpload 'open' click to copy title -

i using asp.net fileupload control upload files. there 'title' text box allows user enter file title well. 'upload' button uploads file server. working fine. problem that, customer has asked copy file name automatically title 'text box' in case user wants custom title same file name. unfortunately, unable figure 1 out. thought there event behind 'open' button of file upload, tap , title gets displayed on fileupload control, should displayed on title text box field. perhaps javascript/jquery might help. any in right direction appreciated. many thanks you can use input's change event jquery: $(function () { $('input:file').on('change', function () { console.log($(this).val()); }) }) you have parse value remove "fakepath" stuff browsers add. you can using split method: var title = $(this).val().split('\\'); console.log(title[title.length - 1])

android - How to get ImageView over boundaries of LinearLayout? -

Image
i have 3 imageviews on linearayout but want have this: is possible make in linear layout? hope kind of idea you.. <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <linearlayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <linearlayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="#d67070"> <relativelayout android:id="@+id/relative_layout_top" android:layout_width="match_parent" android:layout_height="wrap_content" > <

javascript - how i can exchange y1 axis with y2 axis in nvd3.js? -

i'm newbie in javascript using nvd3.js, want visualize data-data using nvd3.js. have tried nvd3.js , part of code : var chart; nv.addgraph(function() { chart = nv.models.lineplusbarchart() .margin({top: 30, right: 60, bottom: 50, left: 70}) .x(function(d,i) { return }) .color(d3.scale.category10().range()); chart.xaxis .tickformat(function(d) { var dx = testdata[0].values[d] && testdata[0].values[d].x || 0; return dx ? d3.time.format('%x')(new date(dx)) : ''; }) .showmaxmin(false) .axislabel("x-axis label"); chart.y1axis .tickformat(d3.format(',f')) .axislabel("y1axis label"); chart.y2axis .tickformat(function(d) { return '$' + d3.format(',.2f')(d) }) .axislabel("y2axis label"); chart.bars.forcey([0]).paddata(false); //chart.lines.forcey([0]); d3.select('#chart1 svg') .datum(testdata) .transition().duration(500).call(chart);

c# - Facebook API .NET post photo to album with custom privacy -

i have fb album custom privacy setting visible specified people . when try post image album using facebook api .net, image not posted , has approved manually me. how approve automatically? p.s. authorize scope: email, publish_stream, publish_actions, read_stream, user_photos. app in facebook in login permissions have: email, public_profile, user_friends. (cannot add more because reqiures platform added). p.p.s. when add image album private or friends or public privacy level works fine , post approved automatically

mysql - Luasql error: "LuaSQL: error connecting to database" -

i working on mysql. trying acess mysql database using luasql.i have installed luasql using yum. tried following code: mysql = require "luasql.mysql" env = assert(mysql.mysql()) con = assert(env:connect ( "db_name", "username", "password", "localhost")) no, name in rows (con, "select * t1") print (string.format ("%s", name)) end while executing above code getting following error : lua: check.lua:3: luasql: error connecting database. mysql: can't connect local mysql server through socket '/var/run/mysqld/mysqld.sock' (2) stack traceback: [c]: in function 'assert' check.lua:3: in main chunk [c]: ? how overcome error.can me proper execution of code? !!! the variables in env:connect should variables such below local db_conn = env:connect("test_db", "root", "abc123", "192.168.1.3", 3306) local cur = db_conn:execute("se

Using array in R for reading data with read.csv from multiple sources -

so trying load multiple csv files project , figured use 1 array, data_in, csv files can reference them data_in[,,1] ##first csv file data_in[1,,2] ## first row of second csv file and on. read files have loop. for (i in seq_along(names)) { file_name <- paste(names[i],".csv", sep = "") data_in[,,i] <- read.csv(file_name, header=t, sep= ",") } but wouldn't here if worked. i'm not used r need declare dimensions of data_in before load in data? there way read data in using index csv file or have use 3d array? sorry if sort of basic. any appreciated. have nice day. to expand on hugh's comment. want list.files() , lapply read files in list of data.frames can access using [[]] files <- list.files(pattern="csv") data_in <- lapply(files, read.csv) read.csv read.table header = t , sep ="," default don't need specify them. then access them use [[]] e.g. head(data_in[[1]])

How is std::vector insert implemented? C++ -

recently rereading iso c++ standard, , found interesting note: note std::vector , constraint on type t of std::vector<t> type t must have copy constructor. actually, if memory of vector full while insertion, allocate new memory of size = 2 * oldsize (this implementation dependent) , copy old elements in , insert 1 element. but wait?? to allocate new memory of type need this, ptr = new t[2*size]; how done, because type t may not have default constructor? then assignment, after allocating memory must assign old values new memory, right? to taking consideration 2 things, how std::vector "only copy constructor?" implementation , language idioms used? it done call allocator function allocate() raw memory , following call allocator construct ( iterator, val) construct element copy using placement new , i.e. similar this: /* approach similar std::uninitialized fill taken */ template<typename t, typename > vector<t,a>::vector(

linux - Php cant write files in tmp -

i'am sorry english skills, stack , need help. have old developers server , new, got php code - <?php // error reporting error_reporting(e_all); ini_set("display_errors", 1); print '<pre>'; var_dump($_files); print '</pre>'; ?> <form action="/test.php" method="post" enctype="multipart/form-data"> <input type="file" name="preview" class="text" size="80" /> <input type="submit" value="send" /> </form> on old server create files ok, on new server did not work.i grateful advice. i assuming new server *nix system. when browser sends uploaded file server placed tmp folder. when test.php move_uploaded_file() moves tmp folder correct place site. check php.ini parameter upload_tmp_dir , check whatever folder points has correct access rights apache web server account write it. after comment fro

git - Remove wasted commit in our remote feature-branch -

i have tree * commit origin/master | * commit origin/my-feature-branch | * commit | * commit | * commit |/ | * commit origin/other-feature-branch |/ i want keep origin/master , want squash origin/my-feature-branch , make clean. "strategy" is: git checkout my-feature-branch git rebase -i head~4 # ... leave first pick line , change others in squash # ... change commit messages 1 git push origin :my-feature-branch git push origin my-feature-branch my new tree clean. * commit origin/master | * commit origin/my-feature-branch |/ | * commit origin/other-feature-branch |/ is correct way? you've got right idea, though instead of deleting remote branch before pushing it, can force push directly with git push origin my-feature-branch -f the reason why want delete remote branch first if force pushing disabled on remote, deleting first way sort of "cheat" , around restriction...though if restriction there, must not want force push, make

linux - echo command behaviour issue in bash -

command="echo 'hello world' > file.txt"; $command; and i'm expecting write "hello world" text file.txt, prints whole string as, 'hello world' > file.txt what wrongs code? after variable replaced, result scanned word splitting , wildcard expansion. other special shell characters, such quotes , redirection, not processed. need use eval reprocess completely: eval "$command"

MAMP - mysql server won't start on port 3306 -

mysql server refuses start on port 3306 ok on 8889. anyone got ideas? banging head on desk here :-) the simplest solution figure out if there instance of mysql running , stopping it, e.g. call in terminal : ps -ax | grep mysqld and kill appropriate mysqld process. and check processes listening on port 3306 : lsof -i:3306

ms office - How to insert HTML page (HTML page with button,combo etc) or Infopath Form (.XSN file) as inline content of email body in MS Outlook -

i have requirement add interactive html form inline content of email body in ms outlook. example if open jpg in paint , copy paste email body area displayed inline content of email body. in similar way need html page displayed in email body area , user should able interact that. similar functionality there in infopath opens outlook ui send infopath form through email can refer that. i want know whether such thing possible or not. if possible need programmatically first need check whether possible manually or not. if requirement not clear let me know try give more detail.

angularjs - ngShow doesnt work when built inside directive -

i want add red star input in case invalid. wrote directive adds red star element near input elemnt. use ng-show star. thought show if input valid. problem is, red star shows, if input invalid. <div ng-app="docu"> <form name="form"> <input name="inp" ng-error-show type="text" ng-model="x" ng-required="true"> </form> </div> var docu = angular.module('docu', ["portaldirectives"]); var portaldirectives = angular.module("portaldirectives", []); portaldirectives.directive("ngerrorshow", function() { return { restrict: 'a', link: function(scope, element, attrs, ctrl) { var varname = "form.inp.$valid"; element.parent().prepend('<span style="color:red" ng-show="!' + varname + '" >*</span>'); } }; }); ht

sql - Error occurred while setting parameters -

i'm trying call procedure mybatis. this procedure signature: procedure pr_start(io_calc in out type_calc, in_restart boolean default true, in_user varchar2 default null); it's in package named package_pp . this how type_calc declared: create or replace type type_calc object ( modelfield varchar2(5 char), sysfield varchar2(5 char), hexfield varchar2(5 char) ); this xml mapping: <select id="pr_start" statementtype="callable" parametertype="map"> { exec package_pp.pr_start( #{io_calc,mode=inout,jdbctype=struct,jdbctypename=type_calc}, #{in_restart,mode=in,jdbctype=boolean,jdbctypename=boolean}, #{in_user,mode=in,jdbctype=varchar,jdbctypename=varchar2} ) } </select> ( p.s. tried call instead of exec , produces same error) my java mapper: public interface packageppmapper { object pr

get object from json string in iOS - Xcode -

i have "json" string this. ** {"success":true,"domains":[{"url":"","name":"test alpha","id":"100"}]} ** i want check success true and, if true, url. how can in iphone application - xcode ? nsdata* data = [mystr datausingencoding:nsutf8stringencoding]; nsdictionary* dictionary = [nsjsonserialization jsonobjectwithdata:data options:nsjsonreadingmutablecontainers error:&error]; if(yes == dictionary[@"success"]) { nsstring *urlstring = dictionary[@"domains"][0][@"url"]; }

c++ - How can I determine the length of a std::string which contains "\0" in its middle? -

i writing c++ application receives input socket. input comes rawdata string , so, contains lots of "\0" in body. my question is, how can determine length/size without stoping @ "\0"s, able read complete socket response? response itsef 148 long, size() retuns 2. size() returns actual length of string , not consider null bytes end string. reason you're getting size of 2 because there different ways set string's value , of them do consider null bytes string terminator. you've mistakenly set value of string string of 2 characters rather set hold complete response data, , size() accurately reflecting mistake. the solution initialize or set string using method not consider null bytes: char buffer[] = "abcd\0efg"; std::string s(buffer, 8); std::cout << s.size() << '\n'; // outputs "8" std::string s2(buffer); std::cout << s2.size() << '\n'; // outputs "4"

java - Find Nested self referred records in same table -

i have problem find nested self referred records db. how can retrieve nested self referred records mysql database.. consider example below id refid name value 1 na 10 2 na b 20 3 1 c 30 (it refering id 1) 4 1 d 40 (it refering id 1) 5 2 e 50 (it refering id 2) 6 3 f 60 (it refering id 3) 7 6 g 70 (it refering id 6) input --> id=1 output ---> id= 3,4,6,7 id -> 1 |-> id 3, 4 |-> id 6 |-> id 7 want find sub levels.... now want find self referred nested sub records db... if want find id=1 means should display sub records of it. i.e wherever refid = 1 , referred id have refid means come display how can retrieve data db.. is sql query can able retrieve records db mysql not support recursive queries. you either create function creates recursion within mysql, or let client code hand

android - Type Error generating final archive: java.io.FileNotFoundException:xx\bin\resources.ap_ does not exist -

i write android project, when run it, has 2 problems can't solve it.. . read other's same problem , answer of them, problem doesn't solve. the problems are: type error generating final archive java.io.filenotfoundexception:xx\bin\resources.ap_ not exist. unparsed aapt error(s)! check console output. my project code is: src/com.divani.marzieh/actionactivity: package com.divani.marzieh; import android.app.activity; import android.os.bundle; import android.view.menu; import android.view.menuinflater; public class actionactivity extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); } @override public boolean oncreateoptionsmenu(menu menu) { menuinflater inflater = getmenuinflater(); inflater.inflate(r.menu.activity_main_actions, menu); return super.oncreateoption

regex - How to match two files and filter a third for matched values by column? -

i appreciate input on following: i want match 2 files there ids (first column) , filter third file columns ids match. i have 3 files (see below). match file1$1 ids in file2 . of ids equal between 2 files, filter file3 columns. file3 columns ordered row1 of file1 . difference id names not denoted column names of file3 . know has same ordering. file1 : id x y id1 x1 y1 id2 x2 y2 id3 x3 y3 file2 : id1 id3 file3 (columns in similar order rows of file1 - without actual ids) z 1 2 3 w 1 2 3 v 1 2 3 output: z 1 3 w 1 3 v 1 3 how should go about? there's no need sed, awk, paste or join. cut -d' ' -f`grep -nffile2 file1|cut -d: -f1|tr '\n' ,`1 file3

ios - SplitView Controller not showing -

i'm trying same thing in adaptivephotos wwdc 2014 sample app have appdelegate.swift following code: class appdelegate: uiresponder, uiapplicationdelegate, uisplitviewcontrollerdelegate { var window: uiwindow! func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: nsdictionary?) -> bool { // override point customization after application launch. window = uiwindow(frame: uiscreen.mainscreen().bounds) var splitviewcontroller = uisplitviewcontroller() var searchboxviewcontroller = searchboxviewcontroller() var searchresultdetailviewcontroller = searchresultdetailviewcontroller() var navigationcontroller = uinavigationcontroller(rootviewcontroller: searchboxviewcontroller) splitviewcontroller.viewcontrollers = [navigationcontroller, searchresultdetailviewcontroller] splitviewcontroller.delegate = self nslog("%@", splitviewcontroller.viewcontrollers) var mainviewcontroller = mainviewcontrolle

c - Why it is recommended to cast a pointer to a generic one before printing? -

ok, have heard things should cast pointer generic 1 i.e void * before printing , must practice use of %p placeholder instead of %d in printf function printing them. i have feeling might done prevent truncation of large addresses while printing or else? point if on machine 64 bit pointers , 32 bit integers; use of %p instead of %d solely job. is aware of practical situations casting technique helpful? because specification of %p specifier prints void * . doesn't know how print other type of pointer. with printf caller must convert argument right type ; printf function cannot perform conversions because not have access type information arguments passed in. can assume passed right ones. c99 7.19.6.1#7 p argument shall pointer void. value of pointer converted sequence of printing characters, in implementation-defined manner. c99 7.19.6.1#9 if argument not correct type corresponding conversion specification, behavior undefined.

Wicket - order of adding components in Java matters? -

i have created simple wicket form dropdownchoice, submit button , 2 textfields, in order try model-chaining. html: <!doctype html> <html xmlns:wicket="http://wicket.apache.org"> <head> <meta charset="utf-8" /> <title>dropdowntest</title> </head> <body> <form wicket:id="selectform"> <select wicket:id="dropdown"></select> <input type="submit" wicket:id="bt"/> <input type="text" wicket:id="age"/> <input type="text" wicket:id="name"/> </form> </body> </html> and java code: public class homepage extends webpage { private static final long serialversionuid = 1l; private class person implements serializable { private

sum value in before oracle trigger -

i have table : table1 (field1, field2, field3). want validate values of updating. if sum(field1) group field2 > 10 raise error. create or replace trigger hdb_tsgh_revise before update of field1 on table1 each row declare v_sum_amt number := 0; begin select sum(field1) v_sum_amt table1 field2 = 'vnd'; if v_sum_amt > 10 raise_application_error(-20000, 'error'); end if; end; error 4091 at: select sum(field1) v_sum_amt table1 field2 = 'vnd'; please me it caused because of ora-04091: table name mutating, trigger/function may not see it as per suggestion given, try using after update trigger instead of before update since case that, should not update value if error, maybe can re-update old value in case of error in after update trigger. you can consider using autonomous transaction .

java - A button with 3 pages, the 3rd one didn't work -

i have page has button, when click it, goes page button, when click button takes third page, doesn't! tried make mainactive2.java , pageone2.java didn't work! help! active_main.xml <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#1d72c3" android:gravity="center" > <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerhorizontal="true" android:gravity="center" android:orientation="vertical" android:textstyle="italic" > <scrollview android:layout_width="fill_parent" android:layout_height="fill_parent&qu

javascript - Form not submitting when clicking submit button -

i added javascript validation form on website. site connects db fine, when click on submit button, no action taken. this form located in footer of page: <div id="add_restaurant" class="full-shadow"> <h4>add restaurant</h4> <form name="submitform" action="<?php echo $pagename ?>" method="post"> <ul class="radio_list" id="category"> <li>category:</li> <li><label class="radiobtn"><input name="category" type="radio" value="healthy" id="is_healthy" checked="checked"/>healthy</label></li> <li><label class="radiobtn"><input name="category" type="radio" value="unhealthy" id="is_unhealthy"/>unhealthy</label></li> </ul> <br /&g

ios - Insert data into sqlite database -

i'm insert data sqlite database , i've seen nslog(@"done") on console result, don't see data update in sqlite database file. pls me !!! here code save data: - (void)savedata:(nsstring *)_id { sqlite3_stmt *statement; nsstring *_databasepath = [[[nsbundle mainbundle] resourcepath ]stringbyappendingpathcomponent:@"data.db"]; const char *dbpath = [_databasepath utf8string]; if (sqlite3_open(dbpath, &db) == sqlite_ok) { nsstring *insertsql = [nsstring stringwithformat: @"insert mytable (id) values (\"%@\")", _id]; const char *insert_stmt = [insertsql utf8string]; sqlite3_prepare_v2(db, insert_stmt, -1, &statement, null); if (sqlite3_step(statement) == sqlite_done) { nslog(@"done"); } else { nslog(@"failed add contact"); } sqlite3_fin

c# - Invoking a plot method in Point Collection class -

i'm trying plot data using window form, invoking delegate, plotted xy graph using button fire/initiate event (see code below). i don't understand why code works plotting xy points doesn't work when want plot y points solely. what mean plotting y solely i.e. x = 0 , 1, ,2, 3, 4, incrementing 1 or in general fixed increment , can 0.1 or 0.01 , or anything. y passed in user. using system.windows.forms; using system.windows.forms.datavisualization.charting; namespace plottingsomedata { public partial class form1 : form { public form1() { initializecomponent(); } // delegate private delegate int plotxydelegate(double x, double y); // parameter chart, series of chart, x,y values of graph private void plotxyappend(chart chart, series dataseries, double x, double y) { // invoke delegate passing in add points method in point collection object chart.invoke(new pl

VB.Net - Visual studio 2010 and Crystal Report, how to pass a query? -

i'm looking make report in vb.net using crystal report, don't understand how pass query , specify target textlabel through query. means execute query , render datatable, how can target crystal report's fields have made query? without connecting database through procedure, connection string. thank in advice , sorry bad english. what first of call query , bind binding source data table , have text boxes or labels binded data source. create parameters in crystal reports , pass these values stored in text boxes or labels parameters. @ website example on how create , pass parameters: http://vb.net-informations.com/crystal-report/vb.net_crystal_report_parameter_string.htm i hope works you, sorry if couldn't help.

kik.send inside a iframe fails on ios even when kik.js loaded -

kik.send inside iframe fails on ios when kik.js loaded works on android correctly. included kik.js <script src="http://cdn.kik.com/kik/1.0.9/kik.js"></script> code snippet: $('#kik_it').click(function(){ kik.send({ title : 'top offers', text : $('.description').html().trim(), pic : $('.coupon_big_image').find('img').attr('src'), data : {dealid : window.location.href} }); }); this known limitation in kik browser on ios. best workaround either remove need iframes (usually idea anyway) or have iframe reach parent window , send message there.