Posts

php - Can you make all Wordpress pages Private simultaneously without a plugin? -

i have wordpress installation thousands of pages public need make private. can't use plugin me; need using wordpress' built in public/protected/private paradigm. ideally, run search , replace on sql export of database. alternatively, willing write php script handle it. it not option make pages private manually - looking programmatic method dealing problem. can help? just set them private in database, using following query: update `wp_posts` set `post_status` = 'private'; this set all posts private, guess won't use query. instead, set articles 'private' use: update `wp_posts` set `post_status` = 'private' `post_type` = 'post'; and disable pages, use: update `wp_posts` set `post_status` = 'private' `post_type` = 'page'; post-revisions have status 'inherit' , right inherited parent page or article.

ios - Importing Data using MagicalRecord -

Image
i'm using magicalrecord import data plist. i'm using code less import explained in tutorial importing data made easy . i have 2 entities manufacturer , car, have 1 many , 1 one relation respectively. plist structure this import work fine nsarray *manufacturers = ... [magicalrecord savewithblock:^(nsmanagedobjectcontext *localcontext) { [manufacturers enumerateobjectsusingblock:^(id obj, nsuinteger idx, bool *stop) { [manufacturer mr_importfromobject:obj incontext:localcontext]; }]; } completion:^(bool success, nserror *error) { }]; but not getting imported [magicalrecord savewithblock:^(nsmanagedobjectcontext *localcontext) { [manufacturer mr_importfromarray:manufacturers incontext:localcontext]; } completion:^(bool success, nserror *error) { }]; any explanation highly appreciated. edit : log of manufacturers array [ { "cars": [ { "carid": 1, ...

Which Scala features have poor performance -

i wandering lately: scala run on jvm, , latter optimized types of operations, there features implementation inefficient on jvm , use therefore should discouraged? explain why inefficient? the first candidate functional programming features - know, functions special classes apply method, creates additional overhead compared languages functions blocks of code. performance tuning deep , complex issue, 3 things come mind. scala collections expressive power, not performance. consider: (1 20).map(x => x*x).sum val = new array[int](20) var = 0 while (i < 20) { a(i) = i+1; += 1 } // (1 20) = 0 while (i < 20) { a(i) = a(i)*a(i); += 1 } // map(x => x*x) var s = 0 = 0 while (i < 20) { s += a(i); += 1 } // sum s the first amazingly more compact. second 16x faster. math on integers fast; boxing , unboxing not. generic collections code is, well, generic, , relies on boxing. function2 specialized on int, long, , double arguments. anything other operat...

c++ - Why does calling WSASocket from DllMain lead to a hang? -

i need destroy objects when dll unloaded. object contains thread calls wsasocket function (for reconnecting connection). so, call destructor dllmain in response dll_process_detach , causes application hang. specifically, call wsasocket locks up. i know functions cannot called dllmain, functions call loadlibrary , freelibrary. why wsasocket function have same problem? it's because shouldn't use dllmain cause. many system procs cause deadlock being called dllmain. declare additional export proc deinitialization of dll , call right before freelibrary. also, recommend read "best dll practices" msft. there lot of reasons stay away dllmain.

How to concatenate strings in a bash script? -

how concatenate 2 strings in bash script? example: concate "foo" , "bar" , without creating new variable "bar". var="foo" echo "$varbar" this not work, because considered variable name varbar . this can work: echo "${var}bar" if put brackets " wrapping name, can concatenate desired. it, bash understands name of variable "var" , rest text.

Errno -8 Servname not supported when using Paramiko, Python -

i'm trying connect server via ssh python script. i'm trying out paramiko. set public key between client , server don't need password. i'm using following code @ moment: ssh = paramiko.sshclient() ssh.set_missing_host_key_policy(paramiko.autoaddpolicy()) ssh.connect('192.168.56.102', 'oracle', none, '~/.ssh/id_rsa') stdin, stdout, stderr = ssh.exec_command('ls') but when running i'm getting error [errno -8] servname not supported ai_socktype any help? this solved adding port number parameter!

c# - How to catch a value inside a gridview row. MVC -

im working on mvc project. how can catch value gridview row , save variable? what want is, click on row, catch value , delete buttonclick. as understand want action on appropriate grid row using jquery? while creating grid row can assign each 1 specific attributes, rowid, etc. create function called on row click, attr values , call (using ajax or not) function controller delete row. ? or create submit button next each row have id , call appropriate function.

javascript - migrate jQuery old code to 1.9 version -

i have jquery code ajaxform written in old version (1.4 think) work fine want rewrite in newer version (1.9) without including jquery-migrate, shold change in code, me please <script> // prepare form when dom ready $(document).ready(function() { var options = { target: '#targetdiv', beforesubmit: showrequest, success: showresponse }; // bind form using 'ajaxform' $('#countyform').ajaxform(options); }); // pre-submit callback function showrequest(formdata, jqform) { var = [ { name: 'ajax', value: '1' }]; $.merge( formdata, extra) return true; } // post-submit callback function showresponse(responsetext, statustext) { } $("#loading img").ajaxstart(function(){ $(this).show(); }).ajaxstop(function(){ $(this).hide(); }); </script>

.net - SQL Stored Call not passing parameter -

i have sql server 2008 stored procedure when called via code shown below returns missing parameter exception @batchid parameter. as can see passing in parameter with cmd.parameters.addwithvalue("@batchid", batchid) but reason not picking when making call server. probably missing simple here, been long day. stored procedure alter procedure [dbo].[spisenginesixcylinderbybatchid] @batchid int begin set nocount on; declare @issixcylinder bit set @issixcylinder = 0 select @issixcylinder = tblbatches.sixcylinder tblbatches idbatch = @batchid select @issixcylinder end code private function isbatchsixcylinder(batchid int32) boolean dim issixcylinder boolean = false try using cmd new sqlclient.sqlcommand("[dbo].[spisenginesixcylinderbybatchid]", _conn) cmd.parameters.addwithvalue("@batchid", batchid) issixcylinder = cmd.executescalar end using catch...

deployment - Conviniend Re-Deploy Application on Glassfish Server -

in moment best way redeploy application our glassfish servers is: stop domain (so don't lots of exceptions because querys comming in while redeploy) remove application domain folder start domain deploy compelete application is there s.t. miss make process less time consuming. thanks hasan you should able use netbeans integrated hot-deployment deploy faster. netbeans detects files have changed , copies these deployment folder. to enable explicitly (it should enabled default): go project -> properties -> build -> run enable "deploy on save" make sure have following in web.xml : <context-param> <param-name>javax.faces.project_stage</param-name> <param-value>development</param-value> </context-param> you can ignore exceptions on redeployment. another option checkout jrebel .

c++ char comparison to see if a string is fits our needs -

i want work if chars of string variable tablolar not contain char small letters between a-z , ',' . suggest? if string tablolar is; "tablo"->it ok "tablo,tablobir,tabloiki,tablouc"->it ok "ta"->it ok but if is; "tablo2"->not ok "ta546465"->not ok "tablo"->not ok "tablo,234,tablobir"->not ok "tablo^%&!)=(,tablouc"-> not ok what tried wrog; for(int z=0;z<tablolar.size();z++){ if ((tablolar[z] == ',') || (tablolar[z] >= 'a' && tablolar[z] <= 'z')) {//do work here}} tablolar.find_first_not_of("abcdefghijknmopqrstuvwxyz,") return position of first invalid character, or std::string::npos if string ok.

c - Avoid send to block when not using O_NONBLOCK -

i have write chat client-server class using unix sockets (without o_nonblock) , select asynchronous i/o on them. @ moment, on server, read 1024 bytes client, , directly handle it. for example, in case of message, receive command formatted msg <msg> (representing client sending message), go through sockets of connected clients , write message on them. this approach works found reading man of send can blocks if socket buffer full , flag o_nonblock not set on socket. i think problem happen when client not read reasons (crash, bugged etc.) , critical server since blocks until client read again. so here question: what correct approach on potentially blocking socket avoid send block if socket buffer full? i'm using select check if there read on sockets maybe should use see if can write on particular socket too? , also, can know how many bytes can read/write when select returns? example, if select "tells" can write on socket, how can know how many bytes c...

CSS3 rotate3d with two angles -

i rotating cube based on mouse position. the mouse has x co-ordinate , y co-ordinate on screen @ time. i using jquery .mousemove() determine pixel co-ordinates, , inside mousemove function, adjusting css rotate3d angle move object. this working fine, move object based on x , y positions. ideally so.. '-webkit-transform': 'rotate3d(1,0,0,'+anglex+'deg)', '-webkit-transform': 'rotate3d(0,1,0,'+angley+'deg)', but doesn't work of course. how both axis rotate different amounts @ same time? you can combine transforms. sum represented matrix3d function. not sure want achieve, in case second transition overrides first one. try: '-webkit-transform': 'rotate3d(1,0,0,'+anglex+'deg)' + 'rotate3d(0,1,0,'+angley+'deg)' this can problably represented 1 transform if tweak [1,0,0] vector/axes