Posts

Showing posts from March, 2010

linux - How to allocate memory dynamically for class using new in C++? -

have following class: class mem { private: int data; public: mem(){} mem(int a) { data=a; } void datadis() { cout <<"valu of "<< data << endl; } }; how allocate memory 10 object of class using parametrized constructor , new operator? since need use new directly, can ten separate objects: mem * mem1 = new mem(42); // , on you can't specify initialisers when allocating array new ; you'll have let them default-initialised, reassign them: mem * mems = new mem[10]; mems[0] = mem(42); // , on don't forget assign them smart pointers (or delete them when you've finished them, if weird requirement use new forbids other forms of sensible memory management). when find working under less insane restrictions, use std::array or std::vector instead of mucking around raw memory allocations: std::vector<mem> mems = {42, 6...

sockets - Linux UDP max size of receive buffer -

what's maximum size of linux udp receive buffer? thought it's limited available ram, when set 5gb rmem_max: echo 5000000000 > /proc/sys/net/core/rmem_max and 4gb actual socket buffer (in erlang): gen_udp:listen(port, [{recbuf, 4000000000}]) when measure buffer utilization, shows: # netstat -u6anp | grep 5050 udp6 1409995136 0 :::5050 :::* 13483/beam.smp i can't exceed 1.4gb. smaller buffer sizes, e.g. 500mb, actual buffer size matched configured value. system debian 6.0, machine has 50gb ram available. it seems there limit in linux. have tried setting rmem_max 2^32-1 success. root@xxx:/proc/sys/net/core# echo 2147483647 > rmem_max root@xxx:/proc/sys/net/core# cat rmem_max 2147483647 2^32 much: root@xxx:/proc/sys/net/core# echo 2147483648 > rmem_max root@xxx:/proc/sys/net/core# cat rmem_max -18446744071562067968 setting 5000000000 yields: root@xxx:/proc/sys/net/core# echo 5000000000 > rmem_max...

Android ExpandableList - Image Loader - Simple Adapter -

i need our help. i need create expandablelistview , put inside more images loaded url. now have this: i take text file xml dunno how show in image image dinamic. this code: main.java public class main extends expandablelistactivity { static final string key_discounted_price = "discounted_price"; static final string key_price = "price"; static final string key_discount = "discount"; static final string key_thumb_url_seller = "seller_image_url"; static final string key_thumb_url = "image_url"; static final string key_description = "description"; static final string key_title_offerta = "title_offerta"; string contenuto_nodo; arraylist <string> array_contenuto_nodo =new arraylist<string>(); arraylist<hashmap<string, string>> songslist = new arraylist<hashmap<string, string>>(); static final string shades[][] = { // sh...

html - jQuery Masonry with InfiniteScroll -

i have problem adding infinite scroll masonry plugin. i'm trying add boxes html file. here's code: var $container = $('#tiles'); $container.imagesloaded(function() { $container.masonry({ itemselector: '.item', columnwidth: 252, gutterwidth: 43 }); }); // infinite scroll $container.infinitescroll({ navselector: '#page-nav', // selector paged navigation nextselector: '#page-nav a', // selector next link (to page 2) itemselector: '.item', // selector items you'll retrieve loading: { finishedmsg: 'no more pages load.', img: 'http://i.imgur.com/6rmhx.gif' } }, // trigger masonry callback function(newelements) { // hide new items while loading var $newelems = $(newelements).css({opacity: 0}); // ensure images load before adding masonry layout $newelems.imagesloaded(function() { // show elems they're ready $newele...

android - ProgressDialog with Soap method -

here trying display progressbar when calling soap service , dismiss progressbar when response came service, progressbar not appear . submits data directly , when tried force application, crashes... i want display progress bar soap method starts , dismiss when gets over... please tell me ??? protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.register); button btnenter = (button) findviewbyid(r.id.btregister); btnenter.setonclicklistener(new view.onclicklistener() { @override public void onclick(view arg0) { if (name.equals("")) { textvalidation.settext("please enter name."); } else if (number.equals("")) { textvalidation.settext("please enter contact number."); } else { textvalidation.settext(""); ...

Matlab: error message running Quantisnp -

i run program called quantisnp used matlab in code. not familiar matlab @ all. got below error message , no output. idea how fix it? fyi, don't have access source code of program.... ??? error using ==> chol matrix must positive definite. matlab:posdef highly appreciate help jean it's hard trying answer question without seeing code here general info problem facing: what see matlab error message. assume quantisnp compiled matlab program can't debug it. in short says @ point program trying calculate cholesky factorization using chol() function, matrix inside not positive definite. of time problem happens because matrix zero, in turn [potentially] caused invalid input parameter check see if parameters using (1) valid , (2) match environment. if there input csv or txt file, make sure path correct. make sure numbers make sense. there zeros or lines somewhere should not there? depending on version of quantisnp have, may have access --verbose switc...

spring mvc - could not instantiate bean class org.springframework.validation.BindingResult -

im getting following exception in spring controller not instantiate bean class [org.springframework.validation.bindingresult]: specified class interface. sorry im new in spring here controller @controller public class sendpasswordcontroller { @resource private javamailsender mailsender; //@autowired //private userservice userservice; @resource private userservice userservice; @resource private changepasswordservice changepasswordservice; @resource private emailsenderservice emailsenderservice; @requestmapping(value = "/emailform" ,method= requestmethod.get) public modelandview sendemail(@modelattribute(value="emailpasswordform") bindingresult result,httpservletrequest request){ modelandview mav = new modelandview("emailform"); string username= null; string password=null; authentication auth = securitycontextholder.getcontext().getauthentication(); ...

c# - Inline Assembly Code to Get CPU ID -

i found nice piece of code here executes asm instructions using api calls in order obtain serial number of cpu: using system; using system.text; using system.runtime.interopservices; namespace consoleapplication1 { class program { [dllimport("user32", entrypoint = "callwindowprocw", charset = charset.unicode, setlasterror = true, exactspelling = true)] private static extern intptr executenativecode([in] byte[] bytes, intptr hwnd, int msg, [in, out] byte[] wparam, intptr lparam); [return: marshalas(unmanagedtype.bool)] [dllimport("kernel32", charset = charset.unicode, setlasterror = true)] public static extern bool virtualprotect([in] byte[] bytes, intptr size, int newprotect, out int oldprotect); const int page_execute_readwrite = 0x40; static void main(string[] args) { string s = cpu32_serialnumber(); console.writeline("cpu serial-number: "...

php - Change variable inside function foreach loop -

i've problem can't solve. think it's easy fix, after 3 hours of searching , trail-error. i've decided ask question on here: this time function schedule application. date_default_timezone_set('europe/amsterdam'); $current_time = time(); $unixtime = $current_time; $time = date("gi",$unixtime); global $time; function time_left($time, $active_class, $maxtime, $mintime){ if($time < $maxtime , $time > $mintime){ global $active_class; $active_class = 'active'; echo 'succes!'; } } here foreach loop, loop through array foreach($rows $row){ switch($hours){ case 1: $t = '8:45 - 9:15'; $mintime = 845; $maxtime = 914; time_left($time, $maxtime, $mintime); break; case 2: $t = '8:45 - 9:15'; $mintime = 845; $maxtime = 914; time_left($time, $maxtime, $mintime); break; /* etc.. etc.. etc... */ } echo "<li class='" ....

What is the need of socket if both the server and client process on same machine? -

i relatively new programming , attempting self learn socket programming. per understanding, socket needed @ both endpoints if process (say server process) needs communicate process (say client process) on network. if server , client processes on same machine, why need sockets because streams or datagrams not going on network? it's within same machine. can please clarify reason this? then how 2 processes on same machine communicate without using sockets? ... that's right, sockets way 2 processes communicate regardless of whether it's on network or within same machine . could invent other mechanisms communication within same machine (and there plenty), why if sockets serve purpose fine?

How can i determine binary files are not corrupted in Delphi 7? -

currently stuck question how can can decide , programmatically , whether file ( binary , zip or exe etc.) broken or not . mean , how windows decide binary file incomplete ? can guide me in right direction ? looking : zip & exe thanks zip files (as many other archive formats) contain checksum (e.g. crc32) allows verify integrity of file. pe header (for .exe files) contains sizes of file sections allow perform checks. in common case, there no means verify integrity of binary file unless there additional information file (and can built in file itself). crc32 code , md5 or sha1 hashes used check whether file corrupted or not.

BASH & MYSQL - logg mysql problems during running of a bash/sh script -

i building bash script makes lot of use of mysql. want add possibility log down comments/errors come database. lets admit simple case. mysql -uuser -ppass dbase <<eof insert table (col) values ("$val"); eof how logging /var/log/mylamescript ? want log warnings, errors, etc ... except "successful" you have redirect standard error appending log file: mysql -uuser -ppass dbase <<eof 2>> /var/log/mylamescript insert table (col) values ("$val"); eof

random - C# Get only numbers 1-15 from RNGCryptoServiceProvider? -

as rngcryptoserviceprovider "safer" (produces high-quality random numbers) random() felt using it. performance not issue. but, instead of reading last digit, , somehow decide when add 0 or 1 before it.. there better (more accurate) way? byte[] data = new byte[4]; rng.getbytes(data); int value = bitconverter.toint32(data, 0); console.writeline(value); you can use modulo operator ( % ). leads biased results, 8 byte input bias quite small. smaller bias system.random has. byte[] data = new byte[8]; rng.getbytes(data); ulong value = bitconverter.touint64(data, 0); result = (int)(value%15+1); or if want uniform numbers: byte[] data = new byte[8]; ulong value; { rng.getbytes(data); value = bitconverter.touint64(data, 0); } while(value==0); result = (int)(value%15+1);

windows - Script to list the files of a folder and export it to a text document -

i wondering if knew of way folders, files , sub-folders of location (such c:\users\username) , export text document on network share (such \server\share\document.txt). thank help! from command line (or use batch file if you're going need lot): dir c:\users\username > \\server\share\document.txt that should trick

xml - XSLT: Wrapping a node and following text node with another tag -

i've got below xml document i'd transform using xslt. input: <abs> <b>heading 1</b> text <b>heading 2</b> text <b>heading 3</b> text <b>heading 4</b> text </abs> i need write transformation each heading , it's following text wrapped in <sec> tag below example shows. desired output: <abs> <sec> <b>heading 1</b> text </sec> <sec> <b>heading 2</b> text </sec> <sec> <b>heading 3</b> text </sec> <sec> <b>heading 4</b> text </sec> </abs> does know how using xslt stylesheet? thanks please find xslt below: <?xml version='1.0'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="abs"> <xsl:copy> ...

jquery - .html property updates once once -

i have following divs <div id="daily" style="display:none"> <p class="scheduledata">every <input type="text" data-bind="value:everynperiods"/> days </div> <div id="weekly" style="display:none"> <p class="scheduledata">recur every <input type="text" data-bind="value:everynperiods" style="width:20px; "/>week(s) on: </p><br/> </div> i have drop down contains daily , weekly options. on dropdown change must able load contents of other div. here code this: $("#dropdown").change(function () { var selected = $("#dropdown").val(); if (selected == "daily") { $("#divtobeloaded").html(""); //$("#divtobeloaded").html($("#daily").html()); $("#divtobeloaded").html($("#daily").contents()); ...

c++ - How to use X509_verify() -

how can use x509_verify(). have 2 certificates. first certificate root certificate signed next certificate (which certificate). want check if certificate signed root certificate using x509_verify() in c++. goal keep code simple , understandable can put online. signature of x509_verify is int x509_verify(x509 * x509, evp_pkey * pkey); suppose of have root certificate in root , certificate in mycert; x509 * root; x509 * mycert; //get root certificate root //get mycert mycert. //get public key. evp_pkey * pubkey = x509_get_pubkey(root); //verify. result less or 0 means not verified or error. int result = x509_verify(mycert, pubkey); //free public key. evp_pkey_free(pubkey); i think you.

c++ - API or library for server-client configuration management -

in software project working in, have management server , hundreds of clients. management server define policies , send clients(or clients take that). think, structure group policy. there api or useful c++ program. i came across netconf named thing haven't succeed run it. considering write configuration management system rpc protocol, if can't find useful don't know if easy implement c++. or think can use web service update clients configuration files. by way not sure call thing "configuration manager" or not. let's consider case if config files huge. if have file list of users , added new 1 not want copy whole file boxes in cluster. main reason why had use version control system such configs management program. to implement it's enough setup 1 of popular vcs (i used mercurial), put configs repository , clone on client's boxes. if need update configs pushing change vcs , execute following each client/host ssh -q user@host "c...

mips - Using GNU ld, how can I force the address of a specific (external) symbol without getting a "relocation truncated" error? -

i have 2 functions, a() , b() , both have specific, fixed load/run-time addresses. compiling a() myself, while b() provided (e.g. in rom). the file a.c follows: extern void b(void); void a(void) { b(); } this generates following assembly code: 00000000 <a>: 0: 08000000 j 0 <a> 0: r_mips_26 b 4: 00000000 nop so it's putting 26-bit relocation b() there (the target of call 26-bit offset address of call instruction itself). let's specific addresses of a , b 0x80001000 , 0x80002000, respectively. should fine; b within reach of a . so in linker script, have this: sections { = 0x80001000; b = 0x80002000; .text : at(0x80000000) { *(.text) } } however, linking a.o script gives me following error: a.o: in function 'a': (.text+0x0): relocation truncated fit: r_mips_26 against `b` presumably, because linker trying fit full 32-bit value ( 0x80002000 ) 26-bit space...

reporting services - Use DataSet from C# code in a SSRS server report -

i have reportviewer in asp.net project loads report in processingmode = processingmode.remote (a .rdl report sits on ssrs server) have dataset generated somewhere else , want push report via code. how can ? (in local mode , .rdlc, seems pretty easy...) first, create parameter in rdl. then in dataset, put: =parameters!example.value the code send parameter, example: reportparameter parameter1 reportparameter = new ("example", namedataset.tostring); reportviewer1.serverreport.setparameters (reportparameter new [] {parameter1 });

hadoop - Oozie distro creation failed -

i trying install oozie 3.3.0 , getting following error when run mkdistro.sh -dskiptests under $oozie_home/bin downloading: http://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-impl/2.2.3-1/jaxb-impl-2.2.3-1.jar [info] ------------------------------------------------------------------------ [info] reactor summary: [info] [info] apache oozie main ................................. success [1.552s] [info] apache oozie client ............................... success [55.093s] [info] apache oozie hadoop 1.0.1.oozie-3.3.0 ............. success [7.014s] [info] apache oozie hadoop distcp 1.0.1.oozie-3.3.0 ...... success [0.785s] [info] apache oozie hadoop 1.0.1.oozie-3.3.0 test ........ success [3.062s] [info] apache oozie hadoop 2.0.2-alpha.oozie-3.3.0 ....... failure [1.445s] [info] apache oozie hadoop 2.0.2-alpha.oozie-3.3.0 test .. skipped [info] apache oozie hadoop distcp 2.0.2-alpha.oozie-3.3.0 skipped failed execute goal on project oozie-hadoop: not resolve dependencies project ...

Android access to all child item in ListView -

i have listview build using custom listadapter. need access child item in list view in order text of textview in in each item in listview. private void calctotalsales () { view v; textview tx; string abc=""; listview mylist = (listview) findviewbyid(r.id.todaysaleslistview); (int = 0; < mylist.getchildcount(); i++) { v = (view) mylist.getchildat(i); tx = (textview) v.findviewbyid(r.id.quantitytb); log.d ("text", tx.gettext().tostring()); } } part in listadapter : @override public view getview(int position, view convertview, viewgroup parent) { viewholder holder; final int _position = position; if (convertview == null) { convertview = l_inflater.inflate(r.layout.activity_today_sales_list_view, null); holder = new viewholder(); holder.txt_itemname = (textview) convertview.findviewbyid(r.id.itemnametb); holder.txt_itemprice = (textview) convertview.findviewb...

objective c - Beginning NSMutableArray - Debug ignored -

i learning objective-c. simple fix has worked nsmutablearrays before. note: have watched 3 videos on tube , read 5 articles before asking question. there plenty of resources available setvalue:forkey, don't believe applies scenario. i trying use simple array support selections made in tic tac toe game. concept simple: - array instantiated 9 array nodes - when selection made current letter placed in corresponding array node - method check end of game reference array nodes. problems: - tried set nsnull values instead of @"" each default object. error of "unexpected interface name 'nsnull' . - nslog logic debug array nodes never executes. assumption array not being populated. @synthesize lblstatus, currletter; @synthesize selections; @synthesize btn0, btn1, btn2, btn3, btn4, btn5, btn6, btn7, btn8; - (void)viewdidload { [super viewdidload]; [selections initwithobjects: @"", @"", @"", @"",...

c# - Missing DirectX SDK -

i have window server 2008 r2 visual studio 2012 installed along .net framework 4.5. want reference microsoft.directx.audiovideoplayback in vs2012 project. however, can't find directx folder "directx managed code" @ under c:\windows\microsoft.net. not see dll under c:/windows/assembly/gac either i can install direct x sdk , don't recall having on other pcs (admittedly uses window 7) i'm not familiar part, missing component install when installed either window 2008 or vs2012? to use have install directx sdk taken msdn (directx.audiovideoplayback): however, minimum operating system run samples , tools in directx 9.0 sdk windows 2000. see: this link further reference. also make sure de-install vs2012 + runtimes before install directx sdk gives trouble when installing vs first.

jquery - Cannot use scrollTo offset when using window.location.hash -

i have single page site position: fixed; header containing main nav. i'm using this plugin smooth scroll each section via main nav. because of fixed header need set offset = height of header. works fine using initialisation: $('.nav-main a').click(function(e) { e.preventdefault(); var anchorlocation = $(this).attr('href'); $.scrollto(anchorlocation, 700, { offset: -86 }); }); but need url include section id e.g. http://domainname.com/#about each link has in it's href e.g. <a href="#about">about</a> use this: $('.nav-main a').click(function(e) { e.preventdefault(); var anchorlocation = $(this).attr('href'); $.scrollto(anchorlocation, 700, { offset: -86, onafter: function() { window.location.hash = anchorlocation; } }); }); so fixes url screws header in disappears once smooth scroll has finished come view if scroll again , offset do...

php - UPLOAD_ERR_INI_SIZE error but post_max_size and upload_max_filesize values look correct -

i trying upload file 17569997 bytes (~16.7mb) . when performing error checking in script, inspect $_files['file']['error'] set 1 ( upload_err_ini_size - uploaded file exceeds upload_max_filesize directive in php.ini ). upon finding error, i'm var_dumping out values , calling phpinfo() try , find out wrong. values related error are: post_max_size 34m upload_max_filesize 32m max_file_uploads 20 memory_limit 128m since $_files populated, there isn't problem post_max_size . $_server['content_length'] showing 17570308 seems correct posting file + rest of form. server running php 5.3.10 on ubuntu . ok, worked out happening here , save else pulling hair out. disk root file system sitting on including /tmp full due log filling (5.5gb). web root sits on disk had plenty of space. i can assume failure write /tmp throws upload_err_ini_size error. cleared disk space on root file system, upload worked first time.

php - how to run a cumulative derived query in yii -

i have table 3 fields(id, jobsprocess,percent) , want work out cumulative percent on fly, derived field. in sql this, returns 13 records. set @x := 0; select id, jobsprocess, percent, (@x := @x + percent) cumaltive `hdb`.`lookupprocess` inner join jobsprocess on jobprocess = process_id projid = 1302035 order id how can in yii? far have following not giving me results want $lastrun = yii::app()->db->createcommand(" select id, jobsprocess, percent , (:criteria = :criteria + percent) cumulative `hdb`.`lookupprocess` inner join jobsprocess on jobprocess = process_id projid = $projid order id " )->queryall(true, array(':criteria'=>0)); returns 13 records cumulative 0. i have tried th3e following error $user = yii::app()->db->createcommand() ->select('id, jobsprocess, percent , (:zero := (:zero + percent)) cumulative') -...

zend framework2 - zf2 formFilter regex howto -

using zendframework v2, have run problem regex validator on field created form factory. other fields (using same pattern) work without problem. any tips, or pointers appreciated. $inputfilter->add($factory->createinput([ 'name' => 'organizationname', 'filters' => array( array('name' => 'striptags'), array('name' => 'stringtrim'), ), 'validators' => array( array( 'name' => 'notempty', 'options' => array( 'messages' => array( \zend\validator\notempty::is_empty => 'organization name field empty', ), ), ), array( 'name' => 'regex',...

c# - FileNotFoundException occurs only when running outside the debugger -

i have simple code opens txt file: streamreader sourcefile = file.opentext(filename) the thing is, when press ctrl-f5 start program, file doesn't exist error. when press f11 go step step, runs smooth , no errors or ever happens , desired results. idea cause of this? i'm using visual studio c# express 2010. the code in program.cs: class1.readpointsfile(@"points.txt"); the function: public void readpointsfile(string filename) { if (!file.exists(filename)) { console.writeline("file doesn't exist."); return; } using (streamreader sourcefile = file.opentext(filename)) { string inputline; int arraysize; arraysize = convert.toint32(sourcefile.readline()); pointsarray = new point2d[arraysize]; int i_keeptrack = 0; inputline = sourcefile.readlin...

html - in jQuery, prevent deselecting all other options in a multiple select with "on" -

i have multiple select options added after page loads. want user able click option select/deselect clicking option, without having press control button, , without clearing selected options. have working select loaded in html, not select contains options added through jquery. $(document).on("mousedown","#myselect option",function(){ if ($(this).prop("selected")) { $(this).prop("selected",false); } else { $(this).prop("selected", true); } }); <select id="myselect" multiple="multiple"> <!-- these options added after page loads --> <option id="id0" value="v0">t0</option> <option id="id1" value="v1">t1</option> <option id="id2" value="v2">t2</option> </select>

javascript - Razor Syntax not working as I expected -

i have on 136 locations latitude , longitude , trying create, essentially, 136 map markers on map using java script, razor , c#. issue is, piece of javascript in razor not showing , curious if doing correctly. var mapmarker; @{ ienumerable<ufa.location.core.location> location = ufalocation___front.helpers.queryhelper.queryhelper.getalllocations(); foreach(var loc in location){ <text> mapmarker = new google.maps.marker({ position: new google.maps.latlng(@loc.latitude, @loc.longitude), map: map, title: "hello world!" }); </text> } } i loop through locations , latitude , longtitude, issue is, markers don't show because piece of javascript in each, doesn't exist. full script bellow: function success(position) { var s = document.queryselector('#status'); if (s.classnam...

c# - Invalid access to memory location -

my code looks this: webbrowser browser = new webbrowser(); browser.width = 700; browser.height = 200; **browser.url = new uri("about:blank");** browser.documenttext = mytext; and error occurred in highlighted line ie: badimageformatexception unhandled: invalid access memory location. (exception hresult: 0x800703e6). i have search in many forums , change project property platform cpu. not works. any appreciated. thanks you can try : webbrowser webbrowser1 = new webbrowser(); webbrowser1.navigate("about:blank"); htmldocument objhtmldoc = webbrowser1.document; objhtmldoc.write("<span style=\"font-size:10px\">text </span>"); panel1.controls.add(webbrowser1); this working fine me.

java - How to control the frequency of MouseEvents in mouseDragged(MouseEvent me) -

example: when click , drag mouse across screen, system picks , registers every mouseevent until release. example, let's clicking , dragging distance yields 10 events. system pick on , register every other mouseevent, such dragging mouse same distance across screen produce 5 mouseevents. is there way control this? , how mousedragged(mouseevent me) work anyway? like, determines how it's called mouse being dragged , can controlled user? on project this: public class myclass implements mousemotionlistener { private static final long event_frequency = 200; //ms private scheduledexecutorservice scheduler = executors.newscheduledthreadpool(1); private scheduledfuture<?> mousedraggedfrequencytimer; private mouseevent lastdragevent; public myclass() { this.addmousemotionlistener(this); } @override public void mousedragged(mouseevent e) { lastdragevent = ...

Why does SQL Server perform a clustered scan when IN clause has a subquery? -

if search users so: select * userprofile userid in (1, 2, 3) the execution plan shows userprofile using clustered index seek if change in clause use subquery: select * userprofile userid in ( select distinct senders.userid messages m join usermessages recipients on recipients.messageid = m.messageid join usermessages senders on senders.messageid = m.messageid recipients.typeid = 2 , recipients.userid = 1 , senders.userid <> 1 , senders.typeid = 1 ) the execution plan shows subquery using clustered index seek userprofile outer query using clustered index scan. how can write both inner , outer queries using seeks? a set of seeks cheaper full scan if rowcount low. sql server pretty conservative if there chance many records found, prefers scan. in example, it's pretty clear userid in (1,2,3) not return many rows. subquery, sql server can't tell. you can force seek with: from userprofile (forceseek) ...

xampp - Javascript not working when accessing from remote computer -

i accessed client page using link http://xx.xx.xx.xx/project/client.php .it has few lines of javascript , html not working @ . when access client page using link http://localhost/project/client.php , works. know should change in javascript code dont know . please tell me . here client code : <html> <head> <style> #chatlog {width:440px; height:200px; border:1px solid;overflow:auto;} #userslog {width:440px; height:200px; border:1px solid;overflow:auto;} #msg {width:330px; height:100px;} </style> <script> function initialize(){ var host = "ws://localhost:12345/project/server3z.php"; try{ socket = new websocket(host); chatlog('websocket - status '+socket.readystate); socket.onopen = function(event){chatlog("websocket status "+this.readystate); }; socket.onmessage = function(event){ chatlog(event.data); }; socket.onclose = function(){ chatlog("websocket status "+this.re...

symfony - Symfony2 FormBuilder: How to add and attribute to multiple form fields -

i want add stylesheet class attribute of fields, not all. public function buildform(formbuilder $builder, array $options) { $builder ->add('name_short', null, array('attr' => array('class' => 'rtl')) ) ->add('name_long') ->add('profile_education') ->add('profile_work') ->add('profile_political') ->add('twitter') ->add('facebook') ->add('website') ; } is there simpler way adding attribute array('attr' => array('class' => 'rtl')) every field? was looking looping fields , setting attribute after adding field builder. more (unfortunately there no setoption method in formbuilder): foreach($builder->all() $key => $value) { $value->setoption('attr', array('class' => 'rtl')); } thanks pointers. you can while co...

php - Pre-compress images on mobile devices -

i'm working on web application allows images uploaded server, pictures take quite some time upload via 3g/h. i'm wondering there kind of way pre-compress image on taking or uploading them? for example, user takes picture @ 3g/h, depending on camera 2 - 3 mb, , starts upload. takes while or connection breaks @ 3g - g - h or whatever switch or drop. browser doesn't take well, , image can , lost. any advice please. :) ps. i'm talking cross (mobile) browser / cross (mobile) platform i think has been answered . mention cross browser/cross mobile platform assumes non-native application using c#/c++. if did develop client mobile application natively have access necessary image libraries (gd) compress images (without resizing them) wish.

c# - find a control inside a tabpage that is created with a usercontrol -

i have created usercontrol, have tabcontrol in there tabpage contains 2 buttons, when button1 clicked, creates new tabpage , user control added controls through tab = new tabpage(); usercontrol1 uc = new usercontrol1(); tab.controls.add(uc); tab.name = "0"; tab.text = tab.name; tabcontrol1.tabpages.add(tab); now when click button2, should put text in textbox inside usercontrol-tabpage created, implemented code, textbox sel = (textbox)tabcontrol1.tabpages["0"].controls["textbox1"]; sel.text = "ssss"; but returns runtime error, saying cannot find said control, tried textbox sel = (textbox)tabcontrol1.tabpages["0"].controls[0]; sel.text = "ssss"; but still returns runtime error, saying cast usercontrol cannot applied textbox. dont know means.. pls me in this.. tried putting in controls[1] returned runtime error, of outofbounds exception. dont know do, or how find control inside usercontrol in tabpage......

c# - EF 5 Code First, multiple parent child with cascade delete? -

i have following model: public class parent1 { public int id {get;set;} public list<contact> contacts {get;set;} } public class parent2 { public int id {get;set;} public list<contact> contacts {get;set;} } public class parent3 { public int id {get;set;} public list<contact> contacts {get;set;} } public class contact { public int id {get;set;} public parent1 parent1 {get;set;} public parent2 parent2 {get;set;} public parent3 parent3 {get;set;} } is possible have cascade deletion in scenario, 3 foreign keys on contact optional, possible enable in ef or there better way of achieving scenario? thanks if want delete contact object when parent object deleted, must configure parent side of association. this. modelbuilder.entity<parententity>() .hasmany(p => p.contact) .withrequired() .hasforeignkey(c => c.parententityid) .willcascadeondelete(true);// turn off change false parameter.

c# - Is this a standard color palette? -

Image
i doing reverse engineering work on program. 1 of things trying pull out of old data color chosen below color pallet the way old software refrencing color index in pallet (so 0 white, 1 yellow, 2 orange, , on). above pallet standard layout of type? what best hope find class built in .net pass same index number in , color back, don't have high hopes finding nice. besides using paint , eyedropper manually map out whole table there option make easier on me? you can write code reads bitmap , examines pixels build palette of colors in bitmap you've extracted.

subtracting in SQL Server -

i have table in sql server have scores competencies, have 1 score standard , 1 actual score. instance s25 actual score , c25 standard score. need find difference between 2 can see above , below standard , cannot figure out how subtract work. way tried select (s25) - (c25) 25_score which did not work if table starts number, bracket it, , might work. error get? select (s25)-(c25) [25_score] table_name