Posts

Showing posts from May, 2013

javascript - Config KCFinder in TinyMCE -

Image
i'm using tinymce text field , need possible making image upload in it, , using kcfinder, problem when click in upload images , appears box in white : following initialization code tinymce (note : i'm programming in angular): vm.tinymceoptions = { resize: false, height: 300, menubar: false, plugins: 'autolink link image preview fullscreen textcolor ', toolbar: 'undo, redo | styleselect | cut, copy, paste | bold, italic, underline, strikethrough | subscript, superscript | alignleft aligncenter alignright | link image | preview, forecolor', file_browser_callback: function(field, url, type, win) { tinymce.activeeditor.windowmanager.open({ file: 'app/template/plugin/kcfinder/browse.php?opener=tinymce4&field=' + field + '&type=' + type, title: 'kcfinder - caminho atual: ', width: 700, height: 400, inline: true, close_previous:

vb.net - i want datagridview cell to be cleared and remain focused -

Image
i have datagridview contains 4 columns item,qty,price,amount. user should enter item name in first column. have table in database item names stored. inserted name should checked if in database or not. if not in database want cell cleared textbox , focus remains in cell. user should not allowed continue until enters correct item name... far have tried this private sub datagridview1_cellendedit(byval sender object, byval e system.windows.forms.datagridviewcelleventargs) handles datagridview1.cellendedit connect() sql = "select productname products productname = '" & me.datagridview1.rows(e.rowindex).cells(0).value.tostring & "' " objcmd = new sqlcommand(sql, objcon) objdr = objcmd.executereader if objdr.read = false messagebox.show("item name not in items list", "item name error", messageboxbuttons.ok, messageboxicon.error) ''clearing cell

configuration - Using berks for local development only? -

i don't want use berks in production because don't idea of nodes going out web pull cookbooks (i want them pull them chef server in normal way). using berks local development because resolves dependencies kitchen me. i thinking adding berksfile , berksfile.lock gitignore, figured i'd ask if possible accomplish berks without removing production. "nodes" never go internet looking cookbooks, they'll sourced chef server, so.... question is: how propose deliver cookbooks chef server used manage production nodes? what people appear commit berkshelf lock file , run "berks apply" against target chef server. fit needs. personally, better separation between development , production/non-production systems. create release tarball containing cookbooks i've tested in development, using "vendor" command in berkshelf, , store binary in revision control system nexus . suspect many consider over-kill, enables me deliver off-line (no in

uwp - How to show Soft keyboard when user click the textBox -

newbie uwp, how show keyboard when user click textbox? i use below , don't see soft keyboard pop when user click textbox. i using vs2015 community version win 10 os pc <textbox inputscope="emailsmtpaddress" /> how just pop keyboard enter text user without inputscope , inputscope? how disappear keyboard when use tap anywhere on screen? would appreciate if can provide links of tutorial. thanks

orientdb2.2 - OrientDB Network Binary Protocol - What is returned when creating a CLASS? -

what meaning of last 2 bytes of output (one part of wrapped record, 1 not) when creating class? i issued command "create class foo extends v". output (annotated understanding of the protocol): writing byte (1 byte): 0 [ochannelbinaryserver] # success writing int (4 bytes): 43 [ochannelbinaryserver] # session id 43 writing byte (1 byte): 119 [ochannelbinaryserver] # w - wrapped record writing short (2 bytes): 0 [ochannelbinaryserver] # full record writing byte (1 byte): 100 [ochannelbinaryserver] # d - record document writing short (2 bytes): -1 [ochannelbinaryserver] # cluster id null writing long (8 bytes): -1 [ochannelbinaryserver] # cluster position null writing int (4 bytes): 0 [ochannelbinaryserver] # version 0 writing bytes (4+16=20 bytes): [0, 0, 12, 114, 101, 115, 117, 108, 116, 0, 0, 0, 15, 1, 0, 84] [ochannelbinaryserver] # record, 84? writing byte (1 byte): 0 [ochannelbinaryserver] # this? the record decodes field named "result". value of re

How to send email to all user with condition using php laravel? -

i using php laravel v5.0. , want send email user divisi = x. query of $penerima shows 3 emails divisi = x. email sent 1 email of 3 emails. know wrong of code? thanks if ($approve != null){ foreach ($approve $x) { $penerima = user::select('email') ->where('divisi','=', $x) ->where('deleted','=', '0') ->get(); mail::send('mail', $data_nomor, function ($m) use ($penerima) { $m->to($penerima)->subject('respond reminder!'); }); } } if showing result of $penerima, result illuminate\database\eloquent\collection object ( [items:protected] => array ( [0] => app\user object ( [table:protected] => users [hidden:protected] => array ( [0] => password [1] => remember_token ) [connection:protected] => [primarykey:protected] => i

angularjs - how to use ng-repeat for array items in object which is inside other object in single ng-repeat -

having data as: { "obj1":{ "obj11":[ { "name":"tim", "roll_number":"45" }, { "name":"tom", "roll_number":"20" }, { "name":"deny", "roll_number":"42" } ], "obj12":[ { "name":"jim", "roll_number":"43" }, { "name":"crook", "roll_number":"46" }, { "name":"michael", "roll_number":"48" } ] } } having keys "obj11" , "obj12" , want ng-repeat specific block of html code items corresponding these specific keys inside obj1. repeated block contains 'name' , 'roll_number' corresponding each object

python - Plotting text on basemap -

suppose want plot 'text' on basemap on spain, work. from mpl_toolkits.basemap import basemap import matplotlib.pyplot plt m = basemap(resolution='l') fig = plt.figure(figsize=(12,10)) m.drawcoastlines(linewidth=0.5) plt.annotate('text',xy=(0,40),ha="center") plt.show() but doesn't work on merc view, no matter x/y value specify. e.g: m = basemap(projection='merc',resolution='c',llcrnrlat=36,llcrnrlon=-20,urcrnrlat=61,urcrnrlon=33) fig = plt.figure(figsize=(12,10)) m.drawcoastlines(linewidth=0.5) plt.annotate('text',xy=(0,40),ha="center") plt.show() will show text in bottom left. how plot text in view?

powershell - writing output file as .txt or .csv to script containing multiple conditions -

i have written script checks service status, tests 2 paths , tests registry value. getting output on power shell console (that because using write-output command). there way write single 1 page output file? struggling find way out-file entire output file. below script. $testpath = test-path "c:\test" $testpath2 = test-path "c:\test" $mcshieldk = get-service -name mcshield | select name $internet = (get-itemproperty -path "hklm:\software\microsoft\internet explorer").mkenabled $hostname = hostname write-host "hostname of comuter is" $hostname if (test-path $machinetype) {} else { write-host "internet is" $internet } if ($testpath -eq $true -and $testpath2 -eq $true) { write-host "test , test1 folder exists" -foregroundcolor green } else{ write-host "folder not exists" -foregroundcolor red } if($mcshield.name -eq "mcshield") { write-host "mcshield service exists" } els

java - getting links array of arrays JSON -

the bottom line have working code. perfectly. receive data without problem, can not figure out how data array of arrays. here json code. me, please) { "timestamp":1470642450, "type":"news", "rows":[ { "categorytitle":"Происшествия", "dateline":"1470641760", "media":[ { "width":"200", "filename":"https://www.****.ru/media/8c/8c/bomba(2)__79cnk5i.jpg", "height":"133" } ], "text":"<div>\r\n<div>\r\n<div>\r\n<div>\r\n<div>\r\n<div>\r\n<div>\r\n<div>\r\n<div>\r\n<div>\r\n<div>\r\n<div>\r\n<div dir=" auto"> На Дону 6 августа был обнаружен склад боеприпасов Великой Отечественной войны. Находк

c++ - Qt application migrated from windows 7 to windows 10, but some warnings -

i have written application in qt 5.4 (windows 7 ) , migrating windows 10 qt 5.5.. there changes in qt correct in code , code builds well, when comes run program there bunch of warnings . dont know , why comes from. warnings : shell\comdlg32\fileopensave.cpp(9456)\comdlg32.dll!00007fff0973260a: (caller: 00007fff0973a866) returnhr[prerelease](1) tid(b94) 80070490 element not found. callcontext:[\pickermodalloop\initdialog\filedialoginitenterprisedata] shell\ext\thumbnailcache\lib\thumbcacheapi.cpp(243)\thumbcache.dll!00007ffee54432dc: (caller: 00007ffee54434ff) returnhr[prerelease](1) tid(b94) 80004005 unspecified error shell\ext\thumbnailcache\lib\thumbcacheapi.cpp(153)\thumbcache.dll!00007ffee5438d28: (caller: 00007fff06713ea0) returnhr[prerelease](2) tid(b94) 80004005 unspecified error shell\ext\thumbnailcache\lib\thumbcacheapi.cpp(243)\thumbcache.dll!00007ffee54432dc: (caller: 00007ffee54434ff) returnhr[prerelease](3) tid(b94) 80004005 unspecified error shell\ext\thumbna

java - Does HttpClient adds any prefix to a JSON response? -

i using apache httpclient 4.5.2 in following code fetch json content. surprisingly "?" gets prefixed in body leading malformed json. code below: public class urldatareader { public static void main(string[] args) throws java.lang.exception { urldatareader obj = new urldatareader(); string eventsurl = "http://api.511.org/traffic/events/?api_key=<my-personal-api-key>&format=json"; string jsontext = null; try { jsontext = obj.readurlcontent(eventsurl, true); } catch (java.lang.exception e) { system.out.print("exception in reading data url"); e.printstacktrace(); } if (jsontext != null) { system.out.println("read json content url :" + jsontext + "\n\n\n"); gson gson = new gsonbuilder().create(); eventqueryresponse response = gson.fromjson(jsontext, eventqueryresponse.class)

multithreading - Concurrent TCP server in C that adjust its size. -

my aim create server connected many clients (but rather limited number). clients running on mobile phones in lan. there can 2 mobile phones, can 10 mobile phones. wouldn't limit max number of phones ahead. i think tcp communication phone rather longer (not simple request/response rather longer dialog between both). thread pool seems better suited many connection, rather short request/response. i think best using simple pthreads . possibly create 1 pthread per 1 connection mobile phone . but here may doubts there can appear many such connections , number of pthreads large. think limiting number of connections example 10 @ same time , in order next mobile phone able connect such server there connected phone must disconnect. i have done this: int cs_fd; printf("waiting new connections on main thread...\n"); while(1) { cs_fd = accept_new_connection(ps_fd); if(cs_fd == failure) { fprintf(stderr, "accept_new_connect

bash - linux curly brackets instead of if-then-else-fi do-done -

are curly brackets suitable replacement other constructs? [ -n "$test" ] && { xx='yes'; echo 'yes' } || { xx='no'; echo 'no' } vs if [ -n "$test" ] ; xx='yes'; echo 'yes' else xx='no'; echo 'no' fi another: num in {000..2}; echo "$num"; done or num in {000..2}; { echo "$num"; } in first example, a && b || c , if a; b else c have different behavior if b has non-zero exit status. [ -n "$test" ] && { echo this; false; } || { echo "this too?"; } your second example is should syntax error. nothing in documentation says can replace do / done pair compound command (which {...} is). update: i'm told maintainer of bash undocumented feature provides backwards compatibility undocumented feature in original bourne shell.

Array Filter limit amount of results PHP -

i have following method public function getnextavailablehousestoattack(\deadstreet\valueobject\house\collection $collection, $hordesize) { $houses = $collection->gethouses(); $housesthatcanbeattacked = array_filter($houses, function($house) use (&$hordesize) { if(!isset($house)) { return false; } $house = $this->housemodel->applymaxattackcapacity($house, $hordesize); if($this->housemodel->isattackable($house)) { return $house; } return false; }); return $housesthatcanbeattacked; however, array can huge . i want limit $housesthatcanbeattacked whatever size of $hordesize set to, need many houses there zombies in horde attack round. however, array $housesthatcanbeattacked end containing 1 million houses, there 100 in zombie horde. is there way limit size of array built callback? you use loop, , stop processing array when have enough houses. $houses = $c

asp.net - Convert integer value in minutes & seconds using vb.net -

i using web application person want book table. before payment, table reserved person 30 minutes. if doesn't make payment reservation deleted. i want display count down timer of minutes , seconds person may know how time left in reservation before payment. i know how use timer how should use in case? the reservation time saved in database. want timer start 30:00 , start decreasing time. should initial value database ? or set value 30:00 ? don't know do. please help protected sub updatetimer() label1.text = system.datetime.now.tolongtimestring() end sub protected sub timer1_tick(sender object, e system.eventargs) handles timer1.tick updatetimer() end sub hope .. dim ts new timespan(0, 30, 0) protected sub updatetimer() ts = ts.subtract(timespan.fromseconds(1)) label1.text = ts.minutes & ":" & ts.seconds end sub private sub timer1_tick(sender object, e eventargs) handles timer1.tick if ts.minutes <= 0 , ts.second

javascript - Putting Primeface dataTable inside Google Maps API InfoWindow -

i have google map several markers. each marker has infowindow pops datatable inside. however, datatable pops doesn't show updated content marker being clicked, unless close panel page on. below map, have datatable , displays correct information. information inside datatable should change, depending on marker clicked. i added onclick event markers , actionlistener, have function initalizes values datatable pop (the same 1 shown below map). again, problem datatable pops not show updated marker values unless close , reopen panel page on. guess datatable not being updated in dom tree? here code: thankyou time. been stuck hours! this.div_ each marker on map. myremote primeface remote command populates bean values datatable. google.maps.event.adddomlistener(this.div_, 'click', function(event) { var ids_jsonstring = json.stringify(ids_); myremote([{ name: 'ids_', value: ids_jsonstring }]); /

image - Generate Thumbnail of Pdf in Android -

Image
i want generate image(thumbnail) pdf file done whatsapp shown below i have tried pdfbox ( https://github.com/tomroush/pdfbox-android ) tika (compile 'org.apache.tika:tika-parsers:1.11') androidpdfviewer ( https://github.com/barteksc/androidpdfviewer ) and still unable find way generate image pdf. pdfbox: there github issue deals problem ( https://github.com/tomroush/pdfbox-android/issues/3 ) still unresolved. note: able extract image pdf using pdfbox androidpdfviewer: github issue ( https://github.com/barteksc/androidpdfviewer/issues/49 ) use pdfiumandroid mentioned barteksc here... sample code generating pdf thumb //pdfiumandroid (https://github.com/barteksc/pdfiumandroid) //https://github.com/barteksc/androidpdfviewer/issues/49 void generateimagefrompdf(uri pdfuri) { int pagenumber = 0; pdfiumcore pdfiumcore = new pdfiumcore(this); try { //http://www.programcreek.com/java-api-examples/index.php?api=android.os

node.js - Can gcloud nodejs modules see each other? -

i'm developing application runs client js code inside node server (not safe, know). i use node vm , although seems safe, want isolate in module though malicious code reads node server code , config, don't see important files. i reading https://cloud.google.com/appengine/docs/flexible/nodejs/configuration-files i'm not sure serves purpose. example: files: < app>/notsafemodule/app.yml < app>/notsafemodule/... < app>/safemodule/app.yml < app>/safemodule/secret.txt are (safemodule) , (notsafemodule) deployed in same container? is possible (notsafemodule) can read (< app>/safemodule/secret.txt)? thanks! modules/services deployed in different instances different urls: safemodule-dot-< app>.appspot.com notsafemodule-dot-< app>.appspot.com so it's not possible see each other..

python - Finding the input dependencies of a functions outputs -

i've been working on python program pycparser supposed generate json-file dependencies of given function , outputs. example function: int test(int testinput) { int b = testinput; return b; } here expect b dependent on testinput . ofcourse can lot more complicated structs , if-statements etc. files i'm testing have functions in specific form considered inputs , outputs in: int test(int testinput) { int anotherinput = databaseread(variableindatabase); int b = testinput; int c; c = anotherinput + 1; databasewrite(c); return b; } here c dependent on variableindatabase , , b same before. i've run wall analysis in pycparser structs , pointers hard me handle, , seems there'd better way. i've read asts , cfgs, , other analysis tools frama-c can't seem find clear answer if thing. is there known way kind of analysis, , if so, should looking into? it's supposed thousands of files , able output these dependencies json, p

oracle - SQL - Get max date from dd/mm/yyyy formated column -

i have db table have column name statusdate . type of column varchar2 , column have data in dd/mm/yyyy format. , want recent date(max date). used max() method not give correct result, example consider following dates 31/08/2014 01/09/2016 after using max(statusdate) result 31/08/2014. i'm using oracle db. i'm try use following quarry since above problem give incorrect results select * my_db.my_table t inner join ( select clientname, max(statusdate) maxdate from my_db.my_table group clientname ) tm on t.clientname = tm.clientname , t.statusdate = tm.maxdate please can suggest proper way thank you moral: don't store dates strings. databases have built-in types reason. so, convert proper date , take max, don't need join this: select t.* (select t.*, rank() on (partition client_name order to_date(statusdate, 'dd/mm/yyyy') desc ) seqnum my_db.my_table t

perforce diff between 2 files in different directories . -

perforce : system such @ compile time few files created in temp directory . requirement ; if created file different file present in workspace copy file temp directory onto workspace after doing check out of file present on workspace. how can diff between 2 files in workspace , output if files same or different . i'd this: copy file(s) workspace. run "p4 reconcile". if files identical, no-op. if files different, end result want (modified files in workspace, opened edit).

sonarqube - FindBugs: please build project before running sonar -

i getting error error: caused by: findbugs needs sources compiled. please build project before executing sonar , check location of compiled classes. if run sonarrunner sonarqube default profile java "sonar way" fine running using new rules contains findbugs repository key causes issues. have tried use sonar.binaries=folder of build classes not helping issue. i ran because running sonar:sonar before install phase, , sources weren't compiled yet. running after fixed me.

javascript - How do disable bootstrap radio button? -

i disable choosing bootstrap radio button. <div class="btn-group" data-toggle="buttons"> <label class="btn btn-primary btn-set-or-raise"> <input type="radio" name="options" id="option1" val="option1" >radio 1 </label> <label class="btn btn-primary btn-set-or-raise"> <input type="radio" name="options" id="option2" val="option2" >radio 2 </label> <label class="btn btn-primary"> <input type="radio" name="options" id="option3" >radio 3 </label> here jquery it: $(document).ready(function() { $(".btn-group :input").attr("disabled", true); }); but still see 1 can click it, , retrieve checked element! see jsfiddle your code working fine disabled attribute there on input radio there still click working on label input

javascript - JqueryGrid bind taking time when passing data from controller -

i have problem when fetch more 20k data using api. data fetching fast when bind in jquery grid taking time 5 8 min here using jquery plugin in db.js , binding in view page , taking soo time. i working on mvc4(.net). controller: [httpget] public actionresult getmerchandise(string vendor = "", string desc = "", string model = "", string sku = "", string sku2 = "", string comment = "", string received = "", int location = 0, int barcode = 0, string barcodeprinted = "", string lastupdate = "", int damage = 0, string created = "", string shipdate = "", string consumedate = "", string pending = "", string isdonated = "", string retreq = "", string returnto = "", int quantity = 0, string grname = "", int custid = 0) { var model = new itemmodels(); itembl ob

SQL in Access Error using GROUP BY -

some 25 years ago learned sql. doesn't me now:) in access have simple query: select bank.bankid, bank.bankname, address.streetname, address.streetnumber, address.zipcode, address.city, bank.transactionfile bank left join address on bank.[bankid] = address.[bankid] now want exclude duplicate records use distinct: select distinct bank.bankid, bank... etc however, not want transactionfile part of distinct selection, in order data want. thought use group statement instead: select bank.bankid, bank.bankname, address.streetname, address.streetnumber, address.zipcode, address.city, bank.transactionfile bank left join address on bank.[bankid] = address.[bankid] group bank.bankid, bank.bankname, address.streetname, address.streetnumber, address.zipcode, address.city but errormessage "you tried execute query not include specified expression 'transactionfile' part of aggregate function". if group bank.bankid same message on bank.bankname. what missing he

javascript - how to submit a form without input submit -

i submit form without input submit. i want submit form after click on img tag . i have form this: <form name="form-form" action="http://localhost/php/enteqal-ax.php" method="post" id="submit_form "> <input type="hidden" id="value1" name="value_php"> </form> i have image this: <img id="img" width="100px" height="100px" src="http://www.shadyab.com/assests/images/upload/thumb_open-menu-roko-restaurant_(17)3.jpg"> my java script code : $('#img').click(function() { var img_src = $('#img').attr('src'); $('#value1').val(img_src); $('#submit_form').submit(); // not works @ }); please remove space present @ end of form id like: id="submit_form " change id="submit_form"

android - what video streaming protocol does lybrate uses? -

i know, streaming protocol lybrate app uses... https://play.google.com/store/apps/details?id=com.lybrate.phoenix&hl=en opentok, twilio or have built own api underlying webrtc protocol? they using native library libopentok.so, suppose corresponds opentok.

git - See changes made in a project -

i have made changes project. have modified copy original copy. see changes have been made in modified project. how achieve that? thank you. git diff shows changes except deleted (and new) files. to check changes compared last commit (no matter client) is: # add changed including deleted files git add -a . # show staged changes git diff --staged now reset changes no need commit , or if well, commit! if want compare against branch or refspec after committing: git diff another_branch_or_refspec head

wpf - Cannot set Foreground Color to a TreeView DataTemplate TextBlock (MVVM) -

i bind treenode item list tree view. not able bind datatemplate textblock foreground color. initally tought binding problem, tried give color manually, namely foreground="red" figured not change text color. xaml: <treeview itemssource="{binding treeviewnodesplccode}" > <treeview.itemtemplate> <datatemplate> <grid> <textblock text="{binding name}" foreground="{binding path=machineobject.color}"/> </grid> </datatemplate> </treeview.itemtemplate> </treeview> code: treeviewnodesplccode=new observablecollection<treenode>() public class treenode: treeviewitem { public string name{ get; set; } public machine machineobject { get; set; } } public class machine { public int32 id { get; set; } public brush color { get; set; }

video.js - using videojs and videojs-contrib-hls not able to configur HLS and videojs.tech.hls are not coming using react js -

using videojs , videojs-contrib-hls not able configur hls , videojs.tech.hls not coming using react js. import videojs "video.js"; window.videojs = videojs; import video 'videojs-contrib-hls'; let player = videojs("really-cool-video",{html5: { hls: { withcredentials: true, usecuetags:true }}}); player.src({ src: "http://clips.vorwaerts-gmbh.de/big_buck_bunny.webm", type: 'video/webm' }); let hls = player.tech({ iwillnotusethisinplugins: true }).hls; here hls undefined coming.

java - find another META-INF/persistence.xml -

i have problem: project search persistence.xml in directory code @configuration @enabletransactionmanagement @enablejparepositories( basepackages = {"com.psc.repository", "com.psc.export.itconfig.repositories"}, repositoryfactorybeanclass = customrepositoryfactorybean.class) @enablejpaauditing public class jpatestconfig { @bean public hibernatejpavendoradapter jpavendoradapter() { hibernatejpavendoradapter vendoradapter = new hibernatejpavendoradapter(); return vendoradapter; } @bean public localcontainerentitymanagerfactorybean entitymanagerfactory() { localcontainerentitymanagerfactorybean factory = new localcontainerentitymanagerfactorybean(); factory.setpersistenceunitname("psc_test"); return factory; } @bean public entitymanager entitymanager(entitymanagerfactory emf) { return emf.createentitymanager(); } @bean public platformtra

ios - Use of unresolved identifier 'FIRInstanceIDAPNSTokenTypeSandbox' -

i'm trying migrate apps google cloud messaging (gcm) firebase cloud messaging (fcm). doc says need put function func application(application: uiapplication,didregisterforremotenotificationswithdevicetoken devicetoken: nsdata) { firinstanceid.instanceid().setapnstoken(devicetoken, type:firinstanceidapnstokentypesandbox) } but unresolved identifier on firinstanceidapnstokentypesandbox import firebase , firebaseinstanceid , firebasemessaging . know why? appreciate kind of clue u guys. thanks! for swift, have use firinstanceidapnstokentype.sandbox instead of firinstanceidapnstokentypesandbox. it works me.

python - Jupyter keyboard shortcut for running a specific cell -

in workflow jupyter notebook, have cell like: %run myscript.py which loads latest version of script functions i'm using. updating script , using function in notebook. therefore, find myself going first cell , running it. convenient if there keyboard shortcut (e.g. run first cell). exist? you can click "ctrl + enter" run chosen cell no matter "edit mode" or "command mode". if want know more available commands, input esc change current mode "command mode" , input "h" show keyboard shortcuts modal.

c++ - How to compare a wstring with a _T("some String")? -

i have function wstring a2t(const string& str) convert string wstring . cannot correct value when compare return value const wstring . example; wstring stron = a2t("on"); if ( stron == _t("on")) { setitemswitch(true); } else { setitemswitch(false); } the if(stron == _t("on")) statement false. wrong code? this a2t : std::wstring a2t(const string& str) { if (str.empty()) return std::wstring(); int sz = multibytetowidechar(cp_utf8, 0, str.c_str(), -1, 0, 0); std::wstring res(sz, 0); multibytetowidechar(cp_utf8, 0, &str[0], -1, &res[0], sz); return res; } the issue in interpretation (or use of) of return value first call multibytetowidechar - return size required buffer including terminating null character. when creating wide string, count null should removed size, string add internally. in addition, on second call, use actual sizes of strings; avoid multibytetowidechar proces

caching - why do we need to keep cache size small? -

i understanding concept of tlb (mmu). confusing if caches (like tlb) great, why don’t make bigger caches , keep of our data in them. simple: such caches expensive . reason why helpful is: "fine tuned". located "very close" required. you might want read memory hierarchy understand balancing between cost , "speed" requirements.

android - GLSurfaceview set position using VideoRendererGui class in webrtc? -

i using glsurfaceview showing remote user's video stream in webrtc based android application. using libjingle library that. have control video scaling i.e. fit fill , vice versa. scaling controlled doing fill fit , last frame rendered on glsurfaceview not getting deleted. please if me that. have tried lot of solutions not working. please don't provide solutions using canvas, because have tried not working here.

jquery - Create array from AJAX request data and use in another function -

$('#get_test').click(function(){ $.post('ajax-request.php', { act: 'start_test' }, function(data) { var jstring = $.parsejson(data); so in jstring have data associated english_word , russian_word . how save russian_word data in array , use in different function? if understand correctly, either pass data directly other function within success handler function so $('#get_test').click(function(){ $.post('ajax-request.php', { act: 'start_test' }, function(data) { var jstring = $.parsejson(data); myfunction(jstring.russian); or persist data scoped variable : var russian=[]; $('#get_test').click(function(){ $.post('ajax-request.php', { act: 'start_test' }, function(data) { var jstring = $.parsejson(data); russian=jstring.russian; and pick value in function : function myfunc(){ console.lo

html - Errors while submitting the form ( php & bootstrap) -

i'm intern @ company right now, , i've create registration , login form website. currently i'm facing problem registration. this errors i declared in tutorials still getting these errors , can't figure out it. this php script: <?php //connection database include('connection.php'); if ($_server['request_method']=='post'){ //validation username $errors = array(); if(empty($_post['user_name'])){ $errors['user_name'] = 'please fill in username';//username }else{ $user_name = mysqli_real_escape_string($con, trim($_post['user_name'])); //validation check if username posted in use. if($check = $connection->query("select * student username = '$user_name'")){ if($check->num_rows){ $errors['user_name'] = 'username in use'; } }else{ $errors['user_name'] = 'the query did not work'; } } /