Posts

Showing posts from August, 2011

c++ - What is more efficient: vector.clear() or if(vector.empty()) clear();? -

as subject states.. version more efficient , why? std::vector a; .. a.clear(); or std::vector a; .. if(!a.empty()) a.clear(); an empty vector valid vector. operation a.clear(); is valid on empty vector. test emptiness before clear unnecessary , time consuming, first 1 more efficient.

javascript - Remove profile links from twitter widget -

i need remove twitter profile links twitter widget iframe on primary school website (some of parents swear lot! head doesn't want kids click on link on school website limited vocabulary!) here's code - works in ff not chrome or ie! <script type="text/javascript"> jquery("iframe").load(function() { jquery("iframe#twitter-widget-0").contents().find("a.profile").each(function(index) { jquery(this).removeattr('href'); }); }); </script> how can make work cross browser, bearing in mind twitter widget sent twitter iframe loads late!

opening raw udp socket in promiscuous mode c -

i trying open raw socket deal udp traffic. need promiscuous. have looked @ lots of resources totally confused. here code: char interface_name[12]; strcpy(interface_name, "eth1"); sd = socket(af_inet, sock_raw, ipproto_udp); if ( sd == -1 ) { perror("error in opening socket."); return; } if ( setsockopt(sd, sol_socket, so_bindtodevice, interface_name, strlen(interface_name)) == -1 ) { perror("error in binding sd."); return; } int 1 = 1; if ( setsockopt (sd, ipproto_ip, ip_hdrincl, &one, sizeof(one)) < 0) { perror("error in setting hdrincl."); return; } struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); strcpy(ifr.ifr_name, interface_name); if (ioctl(sd, siocgifindex, &ifr) < 0) { perror("ioctl(siocgifindex) failed"); return; } int interface_index = ifr.ifr_ifindex; ifr.ifr_flags |= iff_promisc; if( ioctl(sd, siocsifflags, &ifr) != 0 ) { perror("ioctl iff_promisc failed.&

PHP security in getting a parameter value -

i dont know php forgive ignorance. trying have parameter value entered in joomla admin area append string bootstrap container class change page fixed fluid layout. i retrieving value this... $contype = $this->params->get('contype',''); and setting follows... class="container<?php echo "$contype"; ?> however, worried (knowing little php) if security problem since value set $contype - problem? if so, work instead...? $contype = (int) $this->params->get('contype','0'); if($contype == "1") { $contype = "-fluid"; } else { $contype = ' '; } and echo again. necessary? there better way? yes, work , secure. if $contype can parameter, important escape against xss using htmlentities(): echo htmlentities($contype) the way did better, although costs more effort. ;-) just remember use htmlentities in future if need escaping of many parameters , not 1 small customization.

sql server - How to read data from a combobox -

i want read data combobox. know how in mysql , looks this: private sub cmbdescrip_selectedindexchanged(byval sender system.object, byval e system.eventargs) handles cmbdescrip.selectedindexchanged dim getcategorydesc mysqlcommand = new mysqlcommand("select * category catdesc=@field2;", connection) dim reader1 mysqldatareader if connection.state = connectionstate.closed connection.open() end if try getcategorydesc .parameters.addwithvalue("@field2", cmbdescrip.text) end reader1 = getcategorydesc.executereader() while (reader1.read()) txtcatno.text = (reader1("catno")) end while getcategorydesc.dispose() reader1.close() catch ex exception end try end sub and yes code works i'm working sql server 2012, database i'm not familiar with. problem sql server not seem read "@field2". in mysql , that's problem right

php - Redirect Piwik HTTP request to different server -

i have piwik running on 1 server, server a. websites run on different server, server b. don't want users know server a's address (including cookies set), want statistics. presume have redirect requests piwik.php server b server don't know how. ## piwik proxy hide url script allows track statistics using piwik, without revealing piwik server url. useful users track multiple websites on same piwik server, don't want show piwik server url in source code of tracked websites. located in /path/to/piwik/misc/proxy-hide-piwik-url/ folder. should looking for.

mysql - Noon Hour Observation -

i have table number of rows follows: +---------------------+------+ | utc | temp | +---------------------+------+ | 2011-01-30 00:00:14 | -3 | | 2011-01-30 00:40:06 | -4 | | 2011-01-30 01:00:15 | -4 | | 2011-01-30 01:20:14 | -4 | | 2011-01-30 02:00:12 | -4 | | 2011-01-30 02:20:18 | -4 | | 2011-01-30 03:00:16 | -4 | | ... | ... | utc of type datetime , , temp of type int . for each day, find temp value closest day's noon hour. possibly resulting in table looks this: +---------------------+------+ | utc | temp | +---------------------+------+ | 2011-01-30 12:01:14 | -3 | | 2011-01-31 11:58:36 | -4 | | 2011-02-01 12:00:15 | -5 | | 2011-02-02 12:03:49 | -7 | | 2011-02-03 02:00:12 | -8 | | ... | ... | finding single day easy enough: select utc, temp table date(utc)='2011-01-30' order abs(timestampdiff(second,utc,date_add(date(utc),interval 12 hour))) limit 1; but someho

html - How do you apply an effect on image that makes the image slide in the page? -

i wondering how apply effect on images. , not directly on image scroll down page. example, when scroll down, images fade in or slide in side of page. came across skrollr not sure if it's right library. anyone knows how? i came across skrollr not sure if it's right library. given requirements: yes, is.

jquery - $.couch.db().openDoc() & db.getDoc are asynchronous, right? -

trying call methods of subject , works splendid, reach whatever info needed docs requested within methods. want use information outside of methods , whenever try variable come out undefined . from have read these methods asynchronous , hence undefined result. so, how solve it? doing $.ajax({.. async:false..}) kind of works against purpose, * a *jax * a *sync. suggestions, except q&d async:false option? after litt. studies , hack-arounds, solution: use $.ajax({async:false}); , call in fork (web worker) avoid lockdown. it aint pretty - works. still: there pretty solutions out there? edit: there prettier solutions out there , solutions instead of have written above. called 'callbacks' , had not understood concept until now. if don't want mistake please invest few minutes here , save hours of agony.

php - WordPress to .json file....no data appearing -

try convert couple of wordpress table rows wp_posts .json file. not json api plugin i've seen posted on many times. i've tried , produces data. want id, title , post or page content. that's it. also, json api doesn't export .json file. want on server dynamically. so i'm using script produce .json file. <?php $con=mysql_connect("localhost","username","password") or die("database connection failed"); if($con) { mysql_selectdb("database_wp",$con); } ?> <?php $data=array(); $qa=array(); $query=mysql_query("select id, title, content wp_posts order id"); while($geteach=mysql_fetch_array($query)) { $id=$getdata[0]; $title=$getdata[1]; $content=$getdata[2]; $qa[]=array('id'=> $id, 'title'=> $title, 'content'=> $content); } $data['qa']=$qa; $fp = fopen('myjson.json', 'w'); fwrite($fp, json_encode($data)); fclose($fp); ?> but in resul

c# - Retrieve Databound List<T> from ListBox -

so here's question that's either extremely simplistic has never been asked before or else has been asked before, i'm asking question wrongly. so databinding list<myobject> listbox control in winform . like so: list<myobject> list = new list<myobject>(); // add myobjects list... mylistbox.datasource = new bindingsource(list, null); then later want obtain access databound list. i thought work... list<myobject> results = (list<myobject>)mylistbox.datasource; in visual studio, can see datasource property of mylistbox contains list of myobjects , however, cast results in invalidcastexception . is there effective way accomplish this? or should hold onto original list? mylistbox.datasource bindingsource , not list<t> . need binding source, extract out data list property: var bs = (bindingsource)mylistbox.datasource; list<myobject> results = (list<myobject>)bs.list;

c# - Async.RunSynchronously() vs Async.StartAsTask().Result -

lets had f# computation deal in c# , wanted make them run synchronously. difference underneath hood between: public static t runsync<t>(fsharpasync<t> computation) { return fsharpasync.runsynchronously(computation, timeout: fsharpoption<int>.none, cancellationtoken: fsharpoption<system.threading.cancellationtoken>.none ); } or public static t runsync<t>(fsharpasync<t> computation) { return fsharpasync.startastask(computation, taskcreationoptions: fsharpoption<taskcreationoptions>.none, cancellationtoken: fsharpoption<system.threading.cancellationtoken>.none ).result; } sorry if seems simple question, quite new async programming! i think same - reed says, first 1 queues work directly while other 1 creates task , created task lightweight object (under cover, same , task created using taskcompletionsource - c

php - Joomla 3 is giving error after changing hosting company -

i have developed new website in joomla 3 , want transfer new hosting , domain. have copied files , directories , created databases. changed configuration file. problem new hosting company runs php 5.2.17 version , removed string in index.php checking php version. after have strange error warning: require_once(__dir__/includes/defines.php) [function.require-once]: failed open stream: no such file or directory in /usr/.../public_html/index.php on line 28 fatal error: require_once() [function.require]: failed opening required '__dir__/includes/defines.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /usr/.../public_html/index.php on line 28 how can fix it? in advance. can not use php.ini , changing hosting company big problem. minimum requirement of php version php 5.3 joomla 3. should upgrade php version otherwise use joomla 2.5 you may other issues also, if use joomla 3 on php 5.2. fix issue need replace __dir__ dirname(__file__)

SQL condition on firstname and lastname without append or concat -

you have 2 tables customers , blacklist, both columns firstname , lastname. how find customers? please note cannot append or concatenate lastname firstname(or vice versa) because of character limit. i think left join work. please confirm. select c.lastname,c.firstname curtomers c left join blacklist b on (c.lastname = b.lastname , c.firstname = b.lastname) b.firstname null , b.lastname null select c.* customer c not exists ( select * blacklist b c.firstname = b.firstname , c.lastname = b.lastname ) i assume you're inferring "good customer" 1 not in blacklist table? also, have no idea dbms you're using.

c# - Process Output Capture is VERY slow -

i'm running following code in order test if external application consuming 1 of dll's (updater code) processstartinfo psi = new processstartinfo() { filename = "tasklist.exe", arguments = @"/m myservices.dll", createnowindow = true, redirectstandardoutput = true, useshellexecute = false }; process p = new process(); p.startinfo = psi; p.start(); //debug output box, see returns txtoutput.text = p.standardoutput.readtoend(); p.waitforexit(); refresh(); if (txtoutput.text.contains("testprogram.exe")) messagebox.show("found it"); now, code works!!!....but stupid slow. can type same command cmd window , response in tenth of second, reason pause on line p.standardoutput.readtoend() taking anywhere 1 5 minutes!! and actual question: does know why slow? or possibly how fix , make acceptably fast? update: more data if use shell window , dont capture output, can watch task run in she

regex - Removing 3 specific characters, if present from the start of a string VB.net -

i have situation need remove prefix string, if exists. dim str string = "samvariable" needs converted variable easy, trimstart str = str.trimstart("s"c, "a"c, "m"c) except... the string might not start "sam" example: dim str string = "saledetails" this become aledetails which wrong, how replace str = str.replace('sam','') brilliant! now: example 1: dim str string = "samvariable" str = str.replace('sam','') str = "variable" example 2: dim str string = "saledetails" str = str.replace('sam','') str = "saledetails" (unaffected) but.... what if: dim str string = "resample" str = str.replace('sam','') str = "reple" this wrong again! so, question is: how remove "sam" beginning of string only? i had expected trimstart("sam") work, doesn'

android - How (can?) I enable WebKit AudioContext on the Amazon Silk browser? -

i'm working on web app , we're using webkit audiocontext. i'm trying find easiest way run on kindle fire hd table (android 4.x). (chrome not installed default , it's not in app store kindle) the silk browser doesn't seem support webkit audiocontext, thought there might way enable it. (it's optional setting in chrome)

java - How to create android Ad Interstitials? -

i dont interstitialad , coudnt find example.if have example, can post .i try banner works . when try interstitialad error.i want when open app wanna see ads . thanks!! package com.example.reklam3; import android.app.activity; import com.google.ads.*; import android.os.bundle; import android.util.log; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.textview; import com.google.ads.ad; import com.google.ads.adlistener; import com.google.ads.adrequest; import com.google.ads.adrequest.errorcode; import com.google.ads.interstitialad; public class mainactivity extends activity implements adlistener{ private interstitialad interstitial; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); // create interstitial interstitial = new interstitialad(this,"ca-app-pub-90707885707358xx"); // create ad reque

ios - Multiple locks on web thread not allowed! Please file a bug. WebRunLoopLock -

bool _webtrythreadlock(bool), 0x9a42a90: multiple locks on web thread not allowed! please file bug. crashing now... 1 0x5978c88 webrunlooplock(__cfrunloopobserver*, unsigned long, void*) 2 0x2e59afe __cfrunloop_is_calling_out_to_an_observer_callback_function__ 3 0x2e59a3d __cfrunloopdoobservers 4 0x2e37704 __cfrunlooprun 5 0x2e36f44 cfrunlooprunspecific 6 0x2e36e1b cfrunloopruninmode 7 0x5978c50 runwebthread(void*) 8 0x9c81eed9 _pthread_start 9 0x9c8226de thread_start above log come when textfield begin editing.

C++ How can I hide a public class? -

i'm coding game engine , i'm creating resource base classes such vertexes, textures, fonts, etc. now i'm creating basic classes want exposed programmer uses these base classes, such image (uses textures), text (uses fonts), models (uses vertexes) etc the game engine exposed, can call it's functions , such coding game. but don't want them access base classes @ all, , don't want conflict classes well. example, might want create class named "material" ingame resources have "material" class, how can avoid conflict , better, hide these base classes (so don't mess , break something)? edit: example, have exposed class image . contains private instances of quad , texture base classes, , resource manager makes sure there's 1 of these loaded (so don't have duplicate textures/quads in memory). texture has width/height, , manages data loaded card. same quad . image makes sure when image resize requested, changes needs cha

Displaying a constantly changing variable in a text box in excel vba -

i want create text box in excel vba display value of changing variable till final value reached. here code wrote **for i= 0 cwpres_max step 0.1 cw_pressure.value = (cw_pressure name of text box) application.wait + timevalue("00:00:01") next** i want variable count value cwpres_max in steps of 0.1 , @ each step value displayed in text box (cw_pressure). while running, program executing entire delay , displaying final value of 'i', cwpres_max in text box. how go it? google doevents i= 0 cwpres_max step 0.1 doevents cw_pressure.value = (cw_pressure name of text box) application.wait + timevalue("00:00:01") next

python - How to access image files from within executable that is called by hadoop mapper -

i have opencv function written in c++ , compiled binary in linux. function takes image file location source , processes , gives value output. now, using hadoop streaming has mapper written in python calls binary process image. input mapper text file each line has image file path. so far: first tested streaming mapreduce system call instead of calling img processing exe , works expected. have made libraries needed binary such opencv libraries etc. tested mapreduce giving empty file location image processing binary. works supposed , gives embedded error msg within binary output. completes map , reduce , gives output. issues , questions: but when give actual image location binary. mapreduce fails saying error streaming.streamjob: job not successful. error: na any ideas on how give file location binary? or should read image in mapper , send image data binary called exe?

jquery - How to request cross-domain for xml on javascript -

i want show yahoo news feeds in website, need read yahoo rss . how request it, javascript? "access-control-allow-origin" let go? xml won't run cross-site that. convert json using yahoo pipes. using pipe http://pipes.yahoo.com/pipes/pipe.info?_id=djeg41ac3bg8iai2e5pzna , configuring url : http://news.yahoo.com/rss/ , path : channel.item you can make json output grabbing "get json" link gives url: http://pipes.yahoo.com/pipes/pipe.run?_id=djeg41ac3bg8iai2e5pzna&_render=json&path=channel.item&url=http%3a%2f%2fnews.yahoo.com%2frss%2f and here's jsfiddle using pipe http://jsfiddle.net/5km4x/ if don't want rely on pipes, write local server side script nothing proxy remote url , expose it's output. using php, have file called getfeed.php <?php header('content-type: application/xml'); echo file_get_contents("http://news.yahoo.com/rss"); and access (using jquery here) $.get('getfeed.php&#

python - Exporting Pandas series as JSON - error with numpy types -

i want export rows pandas dataframe json. however, when exporting columns got error: typeerror: false not json serializable or typeerror: 0 not json serializable i looked in data , problem occurs numpy.int64 , numpy.bool_ ( numpy.float64 works fine). for example, problem appears following: import pandas pd import simplejson json df = pd.dataframe([[false,0],[true,1]], columns=['a','b']) json.dumps(df.ix[0].to_dict()) (the same thing happens dict(df.ix[0]) ). is there simple workaround export pandas series json? or @ least, function coerce numpy type closest type compatible json? dataframe has method export json string: >>> df.to_json() '{"a":{"0":false,"1":true},"b":{"0":0,"1":1}}' you can export directly file: >>> df.to_json(filename)

html - Spooky stuff happening when hovering over dropdown -

im having problem when im trying create dropdown.(see jsfiddle) navigation menu going side side when im hovering on it.. have not seen other placed can solve problem :/ jsfiddle: http://jsfiddle.net/kavqc/2/ i think problem here place: .dropdown { position:absolute; top:62px; left:0; visibility:hidden; background-color: red; } ps: sry bad english the reason menu jumps right because of margin-left style: .navbar-menu:hover { ... margin-left: 200px; // remove ... } here jsfiddle margin-left removed : http://jsfiddle.net/kavqc/3/

linq to sql - SQL Azure: "The instance of SQL Server you attempted to connect to requires encryption but this machine does not support it" -

i'm getting following sql exception intermittently when azure worker role trying connect azure sql database call executecommand, using linq-to-sql: "the instance of sql server attempted connect requires encryption machine not support it." google seems know nothing error message. stack trace shows it's failing during pre-login handshake: system.data.sqlclient.sqlexception (0x80131904): instance of sql server attempted connect requires encryption machine not support it. @ system.data.sqlclient.sqlinternalconnection.onerror(sqlexception exception, boolean breakconnection) @ system.data.sqlclient.tdsparser.throwexceptionandwarning() @ system.data.sqlclient.tdsparser.consumepreloginhandshake(boolean encrypt, boolean trustservercert, boolean&amp; marscapable) @ system.data.sqlclient.tdsparser.connect(serverinfo serverinfo, sqlinternalconnectiontds connhandler, boolean ignoresniopentimeout, int64 timerexpire, boolean encrypt, boolean trustservercert, boolea

php - Pulling two objects from two separate arrays in a foreach -

i'm sure i'm over-thinking this, steer me straight appreciated. need pull 2 array variables , place them in link can can apply them form in order change respective arrays (these links used pull recipient names , uid values stored in session arrays.) so, in foreach, "$contactlistunique $rec" line seems work fine in order pull username, need figure out way pull uid object. foreach operations don't allow multiple conditions, what's smartest way this? <?php $contactlistuidunique = array_unique($_session['recipientlist']); $contactlistunique = array_unique($_session['contactlist']); foreach ($contactlistunique $rec) { echo "<font color=#808080><a href='removecontact.php?contact=$recuid&recipient=$rec' style='text-decoration: none'> <font color=#808080>" . $rec . "</a></font>"; } ?> try though question not clear me <?php $contactlistuidu

swing - java.awt.event.KeyEvent not capable of fully mappin AZERTY keyboard? -

Image
hello made java program display keyevent.getkeycode() each time press key. the purpose able make kind of bot able drive git/skyrim/fraps using java robot class , keyevent. however seems cannot map azerty keyboard, can see keyevent code same. is there other way of driving keyboard? here program if wondering : main class : package keykeykey; import java.awt.borderlayout; import javax.swing.jframe; import javax.swing.jtextfield; public class mainclass { public static void main(string args[]) throws exception { jframe frame = new jframe(); frame.setdefaultcloseoperation(jframe.exit_on_close); jtextfield nametextfield = new jtextfield(); frame.add(nametextfield, borderlayout.north); jtextfield codetextfield = new jtextfield(); frame.add(codetextfield, borderlayout.south); mykeylistener mykeylistener = new mykeylistener(codetextfield, nametextfield); nametextfield.addkeylistener(mykeylistener); frame.setsize(250, 100); frame.s

php - storing and echoing session data in different pages -

i coding type of donation system minecraft server , understand need session temporarily store data donator submitted in form echo later. lets donator's username mister_fix , rank wants purcahse builder, processor script gives him right link, pay rank, prevent scam want check ip, (im not going here) , submitted in form, way ill sure him submitted form , ill able give him rank. need store submitted in session, when put session_start(); tag in script, try echo $_session['username']; on different page comes blank, solution that? session_start(); needs on pages (in beginning) when you're calling session info

hadoop - Get name of current table being scanned over using MultiTableInputFormat -

when using new new multitableinputformat class possible obtain name of table giving key , values? i tried searching special attribute in context & configuration came unlucky. i found out answer issue. dug around in source various classes , found internally similar table name. string tablename = bytes.tostring(((tablesplit) context.getinputsplit()).gettablename());

Cant Compile c++ library with static library -

i downloaded c++ library want use simulation. it includes: 1- source file "main.cpp" 2- header files in "include" folder 3- static precompiled library "libhj.a" 4- cmakelist.txt in manual suggesting use gnu & cmake compile , produce executable file. i tried several solution out hope! 1- downloaded mingw , cmake on windows 7 , tried use them first produce makefile, use "make" command produce exe file, didn't work properly. 2- switched linux "ubuntu" , get: `enter code here`cmakefiles/exe.dir/src/main.cpp.o: in function `main': main.cpp:(.text.startup+0x2d1): undefined reference `hjb_sl::hjb_sl(mrp, cp, cp, pp, gp, ppp, slp)' main.cpp:(.text.startup+0x2d9): undefined reference `hjb::initfiles() const' main.cpp:(.text.startup+0x2ea): undefined reference `hjb::postprocess()' main.cpp:(.text.startup+0x49c): undefined reference `hjb_fd::hjb_fd(mrp, cp, cp, pp, gp, ppp, fdp)' collect2: ld returned 1 exit

c - Merging in merge sort without using temporary arrays -

i'm trying implement merge sort somehow have been stuck day. [sorry pasting big amount of code wouldn't able without it] implementation: merge sort - function int mergesort(int arr[], int low, int high) { int half = (low + high) / 2 ; /* find middle element */ if (low < high) { if (high - low == 1) /* if 1 element, return */ return; mergesort(arr,low,half); /* sort first half */ mergesort(arr,half, high); /* sort second half */ merge(arr,low,half,high); /* merge */ } return success; } merging step - merge function int merge(int arr[], int low, int half, int high) { int = 0, j =0, k = 0, l = 0, temp; /* initialize indices */ for(i = low, j = half;i < half && j < high; i++,j++) /* swap in array if elements out of order */ { if (arr[i] > arr[j]) { temp = arr[i]; arr[i

hibernate - AMF message error java.io.EOFException implementing graniteDS -

hopefully can me this. i'm working on project spring mvc + hibernate + tomcat 7 in backend , blazeds + cairngorm in frontend, , need migrate blazeds graniteds have :channel.connect.failed error netconnection.call.failed: http: status 500 when trying connect backend, , in tomcat console: error amfmessagefilter:160 - amf message error java.io.eofexception @ java.io.datainputstream.readunsignedshort i don't understand i'm missing here , i've been looking on internet , representative resources found ones: http://www.graniteds.org/public/docs/3.0.0/docs/reference/flex/en-us/html/index.html , http://narup.blogspot.com/2008/08/getting-started-project-graniteds-with.html thanks in advance! here web.xml <?xml version="1.0" encoding="utf-8"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/j2ee h

osx - Accessing Meteor local web server from another local device on Mac 10.8 -

i working on meteor website , conveniently, run on localhost simple command, meteor . however, want able access website other computers on local network. main reason want viewing , testing app on mobile. i running mac mountain lion 10.8, , got rid of of convenient personal web sharing pref panes. else have seen online deals setting own server, want grant access other local device... thanks find out ip address 192.168.1.12 (mac system prefs/network) start meteor in project on port (default 3000) comp on network, browse 192.168.1.12:3000

Restore deleted Eclipse Project -

i wanted make new git repository in eclipse , when deleting old one, unluckily whole project has been deletet workspace! is there way restore project? i appreciate answer!!! if have repository work (like central git server,another developer, computer or that) can clone repository that: file -> import -> projects git -> uri -> type in server/the other developers repo , complete wizard. and here reason why lost work: in order make git work, egit moves project files repository (which special directory). therefore, if delete repository, delete files in it, containing whole project. for future: to move repository, move position using normal file explorer. after that, tell eclipse removing repository repositories view (not deleting it): in repositories view: right-click on repository -> remove repositories view then add repository in new location: in repositories view: upper right corner: add existing git repository view

timezone - Rails ignore daylight savings time -

i having trouble understanding rails' time zone support when comes daylight savings time. i storing all database times in utc . user timezones stored map directly activesupport::timezone values (i.e. central time (us & canada) ). i want ignore daylight savings time. if event starts @ 5:30pm , starts @ 5:30pm whether daylight savings time in effect or not. is possible, considering times stored uniformly, retrieve database times , display them locally daylight savings ignored? there problems going run ignoring daylight savings? i don't mean sound pedantic, but... i want ignore daylight savings time. well, on own then. despite our best hopes , wishes, of real world uses daylight saving time. you can quick primer here . if event starts @ 5:30pm, starts @ 5:30pm whether daylight savings time in effect or not. 5:30 who? if you're saying 5:30 utc, sure. if you're saying 5:30 in central time, have take dst account. otherwise, half

400 Bad Request when calling wcf webservice. Used to work - now fails -

i stumped. worked morning , 400 bad request error. haven't changed in web service nor have changed in tiny app use test web service. thing comes mind saw balloon pop earlier indicating there updates visualstudio 2012. i've been beating head against wall hours , making no progress. i've gone far shut down vs , restart , when didn't work rebooted. unschelved code had shelved @ end of last week , code gets 400 bad request error when test application tries call web service. can wsdl webservice running , responding. anyway, here code test app uses connect web service. guys see wrong? have ideas? private void button1_click(object sender, eventargs e) { var sr = new servicereference1.acordwebservice(); string outxml = file.readalltext(@"..\..\..\wcftester\order.xml"); webrequest request = webrequest.create(sr.url); request.method = "post"; byte[] bytearray = getbytes(outxml); request

c# - OleDB: Not Recognizing tabs -

my problem tab delimited file not being recognized such. i importing data gridview, grid view returning 1 column using (oledbconnection connection = new oledbconnection( @"provider=microsoft.jet.oledb.4.0;data source=" + pathonly + ";extended properties=\"text;fmt=tabdelimited;hdr=" + header + "\"")) { solved(see comments). using schema.ini file fixes issue of tabs not being recognized.

RestKit .20 with CoreData - How to set default values -

i using restkit .20 coredata. have restkit calling json api , storing response coredata model without issues. my question how set default values @ mapping time not on response? in situation, downloading list of alerts alert inbox. need show alerts have been read on local device. have coredata attribute on entity model called alertread (boolean)which update when user marks alert 1=read. my question how set default value of attribute 0=unread @ time data retrieved , mapped. i tried set default value in xcdatamodeld file , did not work. appears restkit sets value nil @ mapping time. one point of clarification..i not think want set attribute mapping attribute value on api because refresh of data override current data on local database. current code mapping. rkentitymapping* alertmapping = [rkentitymapping mappingforentityforname:@"alertmessage" inmanagedobjectstore:_managedobjectstore]; [alertmapping addattributemappingsfromdictionary:@{ @"alertsub

JQuery Plugin for img:hover Descriptions -

i designing website , need make hovering on image dim , display description on , link. know saw jquery plugin this, before, cannot seem able find again? seems used lot of people, wondering if can provide link plugin. here's list of plugins image overlays: http://www.jquery4u.com/plugins/30-text-captions-overlay-image-plugins/

How to MINUS sum of values from sum of values php and mysql -

am new in php, , have serious question answer, hope me. i have table on mysql named "payment" following fields (school_fee | fee_setting | trans_port | trans_setting) in fields setting of fields set actual total amount of money student suppose pay appropriate service per 3 month, , student can pay installment, guys want when set may 100000 @ once in fee_setting, , when student come , pay 20000 school_fee amount reducted each time when student pay school_fee . means (fee_setting) reduct total number of school_fee payed student. i have codes reduct first student , others student results comes negative sign(-), confused don't know problems is. here codes: echo $results['sum(fee_setting)'] - $results ['sum(school_fee)']."</td>"; i think need abs() avoid negative values : echo abs($results['sum(fee_setting)'] - $results ['sum(school_fee)'])."</td>";

beagleboard - Udev rule doesn't run -

i'm trying write udev rule on beaglebone white runs when pantech uml 295 finishes booting. when using udevadm monitor --environment following final output base rule on: udev [3163.454297] add /devices/platform/omap/musb-ti81xx/musb-hdrc.1/usb1/1-1/1- 1:1.0/net/eth1 (net) action=add devpath=/devices/platform/omap/musb-ti81xx/musb-hdrc.1/usb1/1-1/1-1:1.0/net/eth1 id_bus=usb id_model=pantech_uml295 id_model_enc=pantech\x20uml295 id_model_id=6064 id_revision=0228 id_serial=pantech__incorporated_pantech_uml295_uml295692146818 id_serial_short=uml295692146818 id_type=generic id_usb_driver=cdc_ether id_usb_interfaces=:020600:0a0000:030000: id_usb_interface_num=00 id_vendor=pantech__incorporated id_vendor_enc=pantech\x2c\x20incorporated id_vendor_id=10a9 ifindex=6 interface=eth1 seqnum=1151 subsystem=net systemd_alias=/sys/subsystem/net/devices/eth1 tags=:systemd: usec_initialized=3163023666 my udev rule version 1: env{id_bus}=="usb", subsystem=="net", run+=

Is there a way to do python's kwargs passthrough in ruby 1.9.3? -

so have functions in ruby 1.9 really, nice functional equivalent of this: def foo(**kwargs): ...do stuff... def bar(**kwargs): foo(x = 2, y = 3, **kwargs) so ruby has opts, if this: def f(opts) print opts.keys end def g(opts) f(opts, :bar=>3) end g(:foo => 1) i get: script:1:in f': wrong number of arguments (2 1) (argumenterror) script:6:in g' script:9:in <main>' is there way pass opts through g f? your def g(opts) f(opts, :bar=>3) end passes 2 arguments f . let pass one, this: def g(opts) f(opts.merge(:bar=>3)) end

ios - baseURL not working for UIWebView? -

i creating uiwebview load nsstring server service. simple html string, load uiwebview this: urladdress = [[nsurl alloc] initwithstring:urlstring]; //try removing cache new stylesheet shows everytime- not sure if working yet [[nsurlcache sharedurlcache] removeallcachedresponses]; [infowebview loadhtmlstring:returnedhtmlstring baseurl:urladdress]; then reason images not showing , style sheet not working. for instance baseurl looks this https://myserveraddress/ and code css looks this <link rel="stylesheet" type="text/css" href="data/iphone/my.css"> my questions how baseurl prefix onto href? dose request css loadhtmlstring loads onto webview? or different and how can output infowebview source nsstring? see if baseurl prefixing onto href links? or dose work that? any appreciated. how baseurl work? here helpful examples afnetworking documentation: nsurl *baseurl = [nsurl urlwithstring:@"http://example.com/v1

c++ - Must a pointer to an instance of class A be static in class B? -

ide: eclipse juno; compiler: mingw 4.6.2; project: win32 i have mainwindow 2 somewhat-dissimilar mdi child windows: mdichildwindowa , mdichildwindowb . third child window, sharedwindow , not mdi can used either mdi child window. encapsulated in own c++ classes. to avoid proliferation of sharedwindow , borrowed part of singleton design: mainwindowclass::getsharedwindowinstance() return pointer instance of sharedwindow , creating 1 if 1 doesn't exist. mainwindow.h includes sharedwindow* psharedwindow function. (that's close sharedwindow gets being singleton.) when mainwindow instantiates mdichildwindowa , mdichildwindowb , passes this constructors, save in class variable pmainwindow (defined mainwindow* in mdichildwindowa.h , mdichildwindowb.h ). cout of this in mainwindow matches cout of pmainwindow in mdi child window constructors, time function calls pmainwindow->getsharedwindowinstance() , pmainwindow has changed! making pmainwindow stat

Loading images in Java Web Start applet -

in normal applets, use load images jlabels image back2 = getimage(getdocumentbase(), "images/blank_blue.png"); imageicon background2icon = new imageicon(back2); jlabel pic2 = new jlabel(background2icon); when tried doing java web start applet, nothing appeared. in java console, said basic: loaded image: file:/c:/users/jdfksl/desktop/webstarttest/images/blank_blue.png , there no error, wouldn't appear. i got images load in jlabels work in java web start way bufferedimage image=null; classloader classloader = thread.currentthread().getcontextclassloader(); try { image = imageio.read(classloader.getresourceasstream("images/ghast_skin.png")); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } but, wanted shorter way of loading images. there other option? this jnlp file content <?xml version="1.0" encoding="utf-8&

Parsing JSON Object in jQuery and create drop downs -

i want parse json object , create drop downs out of it. there 6 drop downs - producttype reportnames startdate startmonth enddate endmonth i able create first drop down 'producttype' when trying create others shows me undefined error message. here code - html <select id="product_type"></select> <select id="report_type"></select> <select id="startdate"></select> <select id="startmonth"></select> <select id="enddate"></select> <select id="endmonth"></select> javascript var jsonstring = '[{"producttype": "abc","reportnames": ["report1",{"startdate": ["2010","2011"],"startmonth": ["may","june"],"enddate":["2010","2011"],"endmonth": ["may","june"]},"repor

c# - Connecting to SQL Server using windows authentication -

when trying connect sql server using following code sqlconnection con = new sqlconnection("server= localhost, authentication=windows authentication, database= employeedetails"); con.open(); sqlcommand cmd; string s = "delete employee empid=103"; i following error: a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 25 - connection string not valid) a connection string sql server should more like: "server= localhost; database= employeedetails; integrated security=true;" if have named instance of sql server, you'll need add well, e.g., "server=localhost\sqlexpress"

SQL command to calculate from Amount and ID, total weight -

table: orderproducts orderid quantity weight ----------------------------------- 4 5 0.1 4 2 0.5 5 3 2.5 5 7 0.9 1) following sql command, total weight calculated correctly, product quantity ignored. how can expand sql command query quantity of product? select orderid, sum (weight) totalweight orderproducts group orderid now have orderid 4 value (totalweight) => 0.6 must correctly => 1.5 2) in addition, sql command "where" (where other_table.status = "finish") extend table. not work. :-( select orderid, sum (weight) totalweight orderproducts other_table.status = "finish" group orderid query: select orderid, sum(weight*quantity) totalweight orderproducts join othertable b on (b.orderid=b=id) b.status = "finish" group orderid

emacs - How to fill right in org-mode? -

perhaps missed in documentation can point me in direction of how fill right series of columns in emacs's org-mode? believe saw how fill down not recall seeing how fill right. edit: example, looking way take: | 8 | 6 | 7 | 5 | 3 | 0 | 9 | | :=@1$1*2 | | | | | | | and turn into: | 8 | 6 | 7 | 5 | 3 | 0 | 9 | | :=@1$1*2 | :=@1$2*2 | :=@1$3*2 | :=@1$4*2 | :=@1$5*2 | :=@1$6*2 | :=@1$7*2 | which evaluates to: | 16 | 12 | 14 | 10 | 6 | 0 | 18 | starting state: | 8 | 6 | 7 | 5 | 3 | 0 | 9 | | | | | | | | | #+tblfm: @2=@1*2 you state: | 8 | 6 | 7 | 5 | 3 | 0 | 9 | | 16 | 12 | 14 | 10 | 6 | 0 | 18 | #+tblfm: @2=@1*2 by pressing c-c c-c while on line tblfm .

How to open email composer with attachment in titanium? -

i making application in ios , android using titanium .i want open email composer (having attachment) on button click.can please tell me how can in ios , android.? thanks directly documentation. assumes have created button. button.addeventlistener('click', function(e) { // create email window var emaildialog = ti.ui.createemaildialog(); emaildialog.subject = "hello titanium"; emaildialog.torecipients = ['foo@yahoo.com']; emaildialog.messagebody = '<b>appcelerator titanium rocks!</b>'; // add attachment var f = ti.filesystem.getfile('cricket.wav'); emaildialog.addattachment(f); // open window emaildialog.open(); });

extjs 4 grid is not displayed correctly the first time it loads -

Image
i have following problem. have grid custom row height wich set css. my css: .blubb>td { overflow: hidden; padding: 3px 6px; white-space: nowrap; height: 27px !important; } in getrow class assign class rows. works second time load grid. when load grid first time, looks this: so looks css rules won't applied rows, why applied when load grid second time? should know, first 4 columns locked, locked grid. please me fix issue? thx in advance! instead of using getrow , can use tdcls property in ext.grid.column.column see here , or can define custom column: ext.define('ext.ux.grid.stylecolumn', { extend: 'ext.grid.column.column', alias: 'widget.stylecolumn', /* author: alexander berg, hungary */ defaultrenderer: function(value, metadata, record, rowindex, colindex, store, view) { var column = view.getgridcolumns()[colindex]; //we can use different classes in each cell if (record.d

drupal form api file upload -

i have form file attachment. once load file , submit form, if validation errors occur form loaded again, file had uploaded not rendered , have load again. i tried using file_save_upload doesnot seem work. $file_attach_set= file_save_upload('file_attachment1', array()); //$file_attach_setii = $form_state['values']['attc']; $contextid = 150; if(empty($file_attach_setii)){ $form['file_attachment' . $i] = array( '#type' => 'file', "#title" =>'kik' '#default_value'=> $file_attach_set->fid, //'#title_display' => $file_attach_set->uri, '' ); } the file element doesn't have #default_value property. try using managed_file type has property. https://api.drupal.org/api/drupal/developer%21topics%21forms_api_reference.html/7#file $form['file_attachment' . $i] = array( '#type' => 'm

asp.net - Read word documents from C# and Display it Inline in browser -

q 1. how can read ms-word documents(doc , docx) c# without ms office installed. able read unformatted text using stream reader. think can use openxml docx. doc? there open source solution handle it? using ole32dll option in unlicensed scenario? use of ifilter solution? havent seen anywhere samples using though , not sure support in windows 7 , 8. edit : stumbled upon solution , found acceptable situation q 2. i need display doc , docx files in webpage inline or in partial page or iframe. how possible? com interoperablity solution too? maybe can use redistributable interop assemblies microsoft, read ".doc" : http://www.microsoft.com/en-us/download/details.aspx?id=3508 it doesn't require office according description.

javascript - Parameters are passing but not retrieving when mobile.changepage in jquerymobile -

hello have search field search button , 2 drop-down list values when click search button want pass parameter values using mobile.change method.i using following structure page1.html <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>client view</title> <link rel="stylesheet" href="css/jquery.mobile-1.3.2.min.css" /> <script src="js/jquery-1.10.2.js"></script> <script src="js/jquery.mobile-1.3.2.min.js"></script> <script type="text/javascript"> $(document).on('pagebeforeshow',function(){ $("#searchbutton").on('click',function(){ var searchvalue = $("[name='clientsearch']").val(); var searchbyvalue = $("#select-choice-searchby").val(); var statusvalue = $("#select-choice-status").val(); $.mobile.changepag