Posts

Showing posts from May, 2015

how to get rid of "unkown scope" pull-down lists in 2010 Visual Studio/C++? -

i installed ms visual studio 2010, incl visual c++, , default @ top of each file editor window, 2 pull-down lists, 1 single item: "(unknown scope)" , , 1 empty. how rid of these lists altogether? it may "intellisense" - but, disabled intellisense, , lists still there... i went through options, nothing else seems help. well, restarted visual studio , gone. not sure why.

visual studio 2010 - Get data from Outlook to Database -

my project send fields before visual studio outlook body in fields entered in body after reception of messages user can modify data sent in text fields on outlook , sends update data saved in database that's possible update data outlook database ? i have build solution that, use daily read , file mail part of daily workflow. others have hinted need specific need with. if (typeof olitem outlook.mailitem) dim olmailitem outlook.mailitem = trycast(olitem, outlook.mailitem) if olmailitem.permission = outlook.olpermission.olunrestricted strbody = olmailitem.htmlbody 'file:///c:/attsave/header.png else strbody = "rights protected fix if i'm not in debugger" end if each olattach in olmailitem.attachments if olattach.type <> outlook.olattachmenttype.olole olattach.saveasfile("c:\attsave\&quo

effects - Lighting Up A Room Cocos2d -

is possible simulate candle instance in cocos2d. scene black , when candle appears lighten room in realistic way. if possible, how achieve effect? redirections, guidance welcome. thanks. please note, don't want light reflection algorithms, simple use. need game players life abillity see room. you should check out raycasting. if set cocos2d use box2d, can use box2d's raycasting method achieve effect. can make walls in room box2d rigid-bodies, , raycast candle origin number of points on circle around it. if raycast intersects wall, mark location of intersection. @ end can fill in area light inside polygon created of raycast intersection points.

PHP SimpleXML to JSON Encode single element array -

i trying parse xml php single element json array. this have: $t = array(); $a=array("url"=>$test->channel->item->link); array_push($t,$a); echo json_encode($t);; which gives me this: [{"url":{"0":"http:www.example.com"}}] but i looking this: [{"url":"http:www.example.com"}] it seems $test->channel->item->link parses curly brackets {url} but if echo $test->channel->item->link , get: www.example.com without curly brackets. not sure if you're looking for, works :) $xmlstr = '<?xml version=\'1.0\' standalone=\'yes\'?> <container> <channel> <item> <link>www.example.com</link> </item> </channel> </container>'; $test = new simplexmlelement($xmlstr); $t = array(); $a = array("url"=>$test->channel->item->link

initialization - Passing a pointer to a pointer vs passing a pointer for initialisation in C -

i have data structure, linked list, looks like struct listitem { void* data; struct listitem* next; }; typedef struct listitem listitem; typedef struct { listitem* head; pthread_rwlock_t lock; } linkedlist; i using pointer void* data because want make data structure polymorphic can use few different applications. to initialise list (allocate memory , initialise rw lock), pass function init_list(..). when pass pointer list follows, program hangs whenever try , perform further operations on list (e.g. push item it): int init_list(linkedlist* list /* borrowed - list initialise (probably unallocated) */) { list = (linkedlist*)calloc(1, sizeof(linkedlist)); // clear memory, head null pointer printf("allocated memory\n"); if (list == 0) { perror("calloc failed on allocating memory list"); return 1; } printf("initialising lock\n"); pthread_rwlock_init(&list->lock, null); return 0;

conditional - Ruby/Shoes cannot get numeric value from selection of list_box -

i'm trying integer conditional statement based on selection on list_box . cannot make work. also, able remove @acuity = para . code based on this: list_box won't use default value on startup - shoes. shoes.app :title=> 'procedural', :width => 300, :height => 200 @list_box = list_box :items => ["1- ad lib", "2- assist of sb", "3- assist of 1", "4- assist of 2"] button 'compute' @acuity.text = @list_box.text if @acuity == "1- ad lib" @mobility = 11 elsif @acuity == "2- assist of sb" @mobility = 22 elsif @acuity == "3- assist of 1" @mobility = 33 elsif @acuity == "4- assist of 2" @mobility = 44 end end @acuity = para end it's not clear goal is. display @mobility somewhere? assigning value @mobility variable nothing. shoes.app @choice_map = { "1- ad lib&q

php - Return random result from three SQL tables -

i have sql database 3 tables inside called... fruit name fruit color fruit price i attempting return random result each of these 3 tables give me example.... apple - green - $10 currently doing running following php 3 times (with different table each) $result = mysqli_query($con,"select * fruitname"); while($row = mysqli_fetch_array($result)) { echo $row['fruitname']; } this works fine feeling going wrong way. there way 1 command instead of three? if want random row, can way: select * (select * fruitname order rand() limit 1) fn cross join (select * fruitcolor order rand() limit 1) fc cross join (select * fruitprice order rand() limit 1) fp this returns fields in 1 row. note random row different arbitrary row. random row means each row has equal chance of being selected. arbitrary row indeterminate. first row in select without order by arbitrary, not random.

PHP mysql database not populating values into tables -

i creating simple php program stores many rows of data tables. when run program populates 1 row of 10's of thousands of rows trying populate. doesn't give mysql_errors . this code: <?php $tickets = explode(' ', file_get_contents("tickets.txt")); foreach($tickets &$ticket){ $handle = opendir($ticket); while($file = readdir($handle)){ if($file != "." && $file != ".."){ $raw_data = file_get_contents($ticket."/".$file); $raw_data = trim(str_replace("date,open,high,low,close,volume,adj close", "", $raw_data)); file_put_contents($ticket."/".$file, $raw_data); $file_temp = fopen($ticket."/".$file, "r"); while(!feof($file_temp)){ $line = fgets($file_temp); $data_array = explode(',', $line); $date = $data_array[0];

ruby on rails - Rails3 URI() if condition not working -

class applicationcontroller < actioncontroller::base before_filter :store_ref_url def store_ref_url rf = request.referer if ((uri(rf.to_s).host != "dev-beta.foo.com") && (uri(rf.to_s).host != "beta.foo.com") && uri(rf.to_s).port != "3000") session['referer'] = request.referer end end end if domain "dev-beta.foo.com" or "beta.foo.com" or port 3000 in local machine, dont save request.referer in session['referer']. still keeps on saving it. tried several conditions. doing wrong? a couple of suggestions: it looks you're trying determine when you're running in staging or development vs production, in case can use: rails.env.production? to information. can set staging environment deploy on dev-beta.foo.com site, use rails.env.staging? same way. to debug specific question asked, find out request.referer variable on request failing test, open console ,

Where is chrome extension's 'chrome.storage.local' data saved? -

i can find previous localstorage api data in ~/.config/google-chrome/default/local storage directory. see these sqlite files can browse sqlite3. however, i'm moving localstorage api chrome.storage api , saving information chrome.storage.local method. now, how , these files bing saved in file system? can't seem find information regarding in doc . highly appreciated. for firefox use same format chrome addon saved here: c:\users\marc\appdata\roaming\mozilla\firefox\profiles\x5jztslz.default\browser-extension-data\

javascript - How Do I Use Spacebars Template Helpers to Prevent Need For Unnecessary Templates? -

i find myself doing lot: {{> eventtitle}} <template name="eventtitle"> {{eventtitle}} </template> is there way cut out template , do: {{eventtitle}} then in js file: template.eventtitle.eventtitle = function () { return "title!"; }; you can use handlebars.registerhelper : handlebars.registerhelper("eventtitle",function(){ return "title!"; });

php - By default AuthComponent uses FormAuthenticate -

i try use function formauthenticate used in identify function in authcomponent class check user , password in database, seems authcomponenent class doesn't use default do have make settings use formauthenticate function ? regards frank it should using form default, if want force use when add auth $components : public $components = array( 'auth' => array( 'authenticate' => array('form') ));

javascript - Get return value when using call() with node.js -

i programming socket server in node.js using json-socket module, , having trouble. currently when client connects server send command in json object data instance login this { type : 'login', data : { username: 'spero78' } } to deal these requests have commands object var commands = { 'login' : authuser, 'register' : userregister } and these functions called server.on server.on('connection', function(socket) { console.log('client connected'); socket = new jsonsocket(socket); socket.on('message', function(message) { if(message.type != undefined) { if(commands[message.type]){ var response = commands[message.type].call(this, message.data); if(response != undefined){ console.log(response); socket.sendmessage(response); } else { console.log("no response!");

javascript - change Jquery object into <ul><li> -

i have following jquery object :- (function ($) { var menu = [{ title: main1", href: "/" }, { title: "main2", href: "/main2", items: [{ title: "submain2_1", href: "/submain2_1" }, { title: "submain2_2", href: "/submain2_2" }] }, { title: "main3", href: "/main3", items: [{ title: "submain3_1", href: "/submain3_1" }, { title: "submain3_2", href: "/submain3_2", items: [{ title: "subsubmain3_1", href:

sql - Archive Posts after set time with ruby and rails -

i want archive (or delete) posts after 24hours. possible ? when user logs in after 24hours previous post not shown instead link create new post next 24hours. not matter if previous posts gets deleted love learn to both ways. cheers one way without having alter or destroy data post use scope on record. example, like: scope :recent_posts, lambda { where("created_at <= ?", (time.zone.now - 24.hours).to_s(:db)) } a couple things understand this: any place want have recent posts appear, have use .recent_posts scope the lambda needed because causes current time (time.now) evaluated @ run time every time scope invoked; doing no lambda make evaluation of time.now static , not change on time. the .to_s(:db) ensures timestamp formatted correctly evaluation database. it assumes have timestamps on posts table. it possible apply default_scope used every query against model except explicitly excluded. regarded bad practice because it's easy make mistakes not

symfony - How to get params in twig file -

how can use $_get params in twig file using php , alerting js. uri-> ?comment=added... in twig, if($_get['comment'] == "added"){ ...echo '<script>alert("in twig file!");</script>'; } hope you {% if app.request.get('comment') == "added" %} <script>alert("in twig file!");</script> {% endif %}

java - How to get around circular references when using Gson? -

i building android application, in using gson store object data. have type goal using has following properties: private long id; private string goalname; private boolean ismaingoal; private goal upperlevelgoal; private goal maingoal; private arraylist<goal> subgoals; private int goallevel; private string textviewsubgoalline; private arraylist<urlcomplex> siteswithingoal; when using gson's tojson() method, stackoverflowerror . have read because gson cannot handle circular references -- is, cannot perform tojson() on goal or arraylist<goal> properties. i understand can somehow use typetoken around issue. ( gson.tojson() throws stackoverflowerror ) however, have read manual ( http://google-gson.googlecode.com/svn/tags/1.1.1/docs/javadocs/com/google/gson/reflect/typetoken.html ) , don't understand how can used so. does know way around using circular references can store info in json via gson? typetoken won't help, not made that. if w

java - Applet - Unable to write file -

i'm trying write sample file applet not working. below code. applet public class pasteimageapplet extends japplet { clipboard clipboard; toolkit toolkit; jlabel lbl; public string getclipboardimageurl(string server) { lbl.settext("pasting image"); string url = ""; try { dataflavor dataflavor = dataflavor.imageflavor; system.out.println(dataflavor.getdefaultrepresentationclass()); object object = null; try { object = clipboard.getcontents(null) .gettransferdata(dataflavor); joptionpane.showmessagedialog(null,"image found."); try { writer output = null; string text = "test write file"; file file = new file("write.txt"); output = new bufferedwriter(new filewriter(file)); o

Magento block user email extension -

hi how can block user email extension being registered? example don't want users register using email extension @example.com . there default way in magento done? you can add 1 new class regex validate example.com domain enter customer. just add validation.js this /@example.com\s*$/.test(mystring) true if string ends in @example.com (plus optional whitespace). hope sure you.

three.js - How do you resize a canvas without flicker? -

many of three.js samples flicker when window resized or have white border frame. example: http://threejs.org/examples/webgl_animation_skinning.html on other hand webgl aquarium not flicker. how done? you need call render straight away after resizing window size. even better can have requestanimationframe , resize , render in 1 function call. make sure reflow , render happens straight away in 1 reflow, rather separate leads flickering.

c++ - How to print wchar_t * in C console? -

i'm using netbeans 7.3 , mingw compiler #include <iostream> using namespace std; int main() { wchar_t a[] = l"std"; wchar_t b[] = l"Стандарт"; wcout << a; wcout << b; // not printed return 0; } output : std please me, how print? std::locale::global(std::locale("")); std::wcout << l"Стандарт";

android - How to make ANE that accesses GooglePlay GameServices -

i develop adobeair app android. so, try make ane(actionscript native extensions)that accesses googleplay gameservices. but, working because of following problem. [error] 07-22 11:22:44.976: w/bundle(24987): key com.google.android.gms.games.app_id expected string value java.lang.integer. default value <null> returned. 07-22 11:22:44.991: w/bundle(24987): attempt cast generated internal exception: 07-22 11:22:44.991: w/bundle(24987): java.lang.classcastexception: java.lang.integer cannot cast java.lang.string 07-22 11:22:44.991: w/bundle(24987): @ android.os.bundle.getstring(bundle.java:1069) 07-22 11:22:44.991: w/bundle(24987): @ abh.a(sourcefile:137) 07-22 11:22:44.991: w/bundle(24987): @ ato.a(sourcefile:450) 07-22 11:22:44.991: w/bundle(24987): @ com.google.android.gms.games.service.gamesintentservice.onhandleintent(sourcefile:2257) 07-22 11:22:44.991: w/bundle(24987): @ android.app.intentservice$servicehandler.handlemessage(intentservice.java:65) 07-22

javascript - How to pass a jquery value in a div or form and assign it in a hidden textbox? -

just want ask question passing value using jquery , assigning in form hidden textbox. here's code hope can me. **homepage.php** <?php $cat_id = $row['salescatid']; ?> <input type="button" name="add_comment" data-value="<?php echo $cat_id; ?>" value="add comment" class="comment" /> . . <div id="comment_category"> <!-- display comment here --> </div> <?php echo form_open('category_controller/insert_comment'); ?> <div id="comment_add" style="display: none;"> <input type="hidden" value="" name="cat_id" /> //here's problem how can value jquery? <input type="hidden" value="sales_category" name="type"/> <label>write comment</label><br /> <textarea name="comment_category" style="width: 50%; resize: none

PHP parser/execution order, classes extending classes defined later in file -

<?php class b extends { public $attribute2; function operation2() { echo 'operation2'; } } $b = new b(); $b->operation1(); $b->operation2(); class { public $attribute1; function operation1() { echo 'operation1'; } } it shows output: operation1operation2 question: i put class a{} @ end of script, when goes first line class b extends a thought show error message, undefined class a , not, why? the order in define classes in file not matter. php not go through script line line. parse whole file, load classes, , execute procedural code. if remember correctly, hasn't been case. think php 3 had difficulty this.

Mongodb : find documents including references to sub-documents [node-mongodb-native] -

i have following mongodb documents : users : {'_id' : '12345', 'fullname' : 'abc'} , files : {'_id' : 'file001', 'path' : 'patha', 'users_id' : '12345'} {'_id' : 'file002', 'path' : 'pathb', 'users_id' : '12345'} how query or find 'files' documents in way 'users_id' referencing 'users' document has full 'users' document? expected output : {'_id' : 'file001', 'path' : 'patha', 'users_id' : '12345', 'user' : {'_id' : '12345', 'fullname' : 'abc'}} {'_id' : 'file002', 'path' : 'pathb', 'users_id' : '12345', 'user' : {'_id' : '12345', 'fullname' : 'abc'}} in way, access file owner's fullname such : file.user.fullname i app

html - Change referer field in HTTP header -

Image
after asking question image cannot displayed in html . i've been searching solution. lucky find header of request have field named referer : i think cause of problem. local server might have refused request avoid hotlinking. server online, can't modify white list. is there way fake referer in html page? no, there isn't. browser controls, not html. the best can proxy server-side. then, can whatever want request headers.

microdata - Rich Snippets Review Aggregate displaying images in search results -

i'm trying image included within google search results review aggregate, , have not had success. based on page google, should possible: https://support.google.com/webmasters/answer/146645?hl=en&ref_topic=1088474 however, have been unable google structured data tool display image i've specified: http://www.google.com/webmasters/tools/richsnippets?q=http%3a%2f%2fwww.kidspot.com.au%2fparenting-directory%2fskincare%2b247%2fcleanskin-candle-company%2b38267%2fnational.htm there image specified page, localbusiness , review aggregate, none of these used. i'm not sure if structure of microdata on page wrong, or if it's issue using localbusiness object or if google doesn't want display images. any appreciated cheers chris the max image dimensions must be: height 120px , width 100px max aspect-ratio 3. specify thumbnails

html - Facebook Comments box plugin automatically changed width -

Image
http://adamginther.com/wedding/?# as can see on "guestbook" component of website, width of facebook plug-in within div has changed abruptly. strange error had worked in mamp didn't(the same time automatically adjusted width. is there reason why happening/any way fix it? adjust overflow needs stay @ scroll because needs same width of div. your iframes margin-left causes issue see image so add iframe { margin-left:0px !important; }

android - I want to take the date from DatePicker -

this question has answer here: how date date picker in android? 6 answers well doing app has 1 activity , class called mypicker extends dialogfragment , implements datepickerdialog.ondatesetlistener the thing when user click in button datapicker appear , want take date datepicker texfield activity. how recommend that? if changing date in date picker can this datepicker.setondatechangelistner(new ondatechangedlistener() { public void ondatechanged(datepicker view, int year1, int monthofyear1, int dayofmonth1) { year = year1; monthofyear = monthofyear1; dayofmonth = dayofmonth1; } } );

Accessing python class member inside methods -

this code class mine: def __init__(self): var = "hello" def mfx(self): var += "a method called" print var me = mine() when call me.mfx() gives following error >>> me.mfx() traceback (most recent call last): file "<pyshell#1>", line 1, in <module> me.mfx() file "d:\more\pythonnnn\text.py", line 5, in mfx var += "a method called" unboundlocalerror: local variable 'var' referenced before assignment >>> i need var use inside class. don't want self.var . why happening? how can make variable can used everywhere inside class. using python2.7 you should qualify var. ( self.var instead of var ) class mine: def __init__(self): self.var = "hello" def mfx(self): self.var += "a method called" print self.var me = mine() me.mfx()

sublimetext2 - Sublime Text 2 - writing a script to process multimarkdown -

there excellent package preview markdown written using sublime text. wanted know how might modify it, or perhaps use basis writing 1 process multi-markdown. i'm using linux (ubuntu) , i'm calling multimarkdown in terminal on each file. one of issues think might face multimarkdown refuses parse open file reason. any thoughts on how might begin or if alternative solution exists gratefully received. there multimarkdown option in syntax list - view > syntax > markdown > multimarkdown. isn't working? way syntax (and other) files in packages folder of sublime text 2. syntax file: /users/[username]/library/application support/sublime text 2/packages/markdown/markdown.tmlanguage and multimarkdown file in same directory.

java - Android I Need 1 Superscript Character in the MIDDLE of a String in the Middle of an Array -

now saw tons of options none of them work me or far indirect me sort of uh, extrapolate need. what have list view , there's few places need use superscript 6, cannot life of me find way in data list array... the main java behind activity: cadence_list cadence_list_data[] = new cadence_list[] { new cadence_list("perfect authentic", "v→i", "v→i", "strongest", "must been in root position tonic doubled in soprano", "definitive end of section/piece"), new cadence_list("imperfect authentic", "v→i", "v→i", "extremely strong", "v tonic 1 or more inverted or not containing tonic in soprano; v7, vii° , vii°⁶ subsitute v", "firm end of section/piece"), new cadence_list("half", "any→v", "any→v", "weak", "---", "creates desire continue on"), new cadence_list("phrygian

android - Actionbar home button click -

i have problem regarding actionbar home button. when app starts, home button not clickable, , nothing. when move 1 level in app, set home clickable, , use button. when go main menu, home button stuck forever clickable, altough nothing now(as should). still gets highlighted(it should not). any ideas how make home button not clickable, after has been set clickable once? i'm using actionbarsherlock , holo-everywhere if matters. try this, public boolean onoptionsitemselected(menuitem item) { super.onoptionsitemselected(item); switch(item.getitemid()) { case android.r.id.home: preferenceactivity.this.onbackpressed(); //preferenceactivity activity name, can change break; } return true; }

python - Can users edit the notebooks on a public notebook server? -

i'm considering ipython notebook educational purposes. idea provide students webbased demos illustrate topics of lecture. i'd students able change parameters of code can study impact or create own examples. i've learned possible setup public ipython notebook server . understand it, provides full functionality of notebooks (not displaying them) exposed public. right? bonus question: how can prevent users persistently changing notebooks provide "session copy"? yes, that's right. public ipython notebook server provides full funcionality connects via browser. has server's password can edit/create/delete notebooks on server. as far know, there's no possibility prevent users persistently changing notebooks on server. dirty workaround be: every student copies central notebook (file --> make copy) , works in copied notebook only. this, however, doesn't prevent abuse/unintentional changes students in central notebook.

html - bootstrap not working accordingly -

Image
i have viewed 1 tutorial online creating responsive navigation bar suppose this i have followed accordingly, added css file along js file isn't working. ends this. gui working fine. however, there isn't extension show other 2 option have picture above. nothing happens when click extension. this how enter codes responsive navbar <!doctype html> <html lang="en"> <head id="head1" runat="server"> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>ipolice</title> <link rel="stylesheet" type="text/css" href="css/bootstrap.css" /> <link rel="stylesheet" type="text/css" href="css/bootstrap-responsive.css" /> <link rel="stylesheet" href="

sqlite - How to find a gap in range in SQL -

this question explains how find first "unused" number in table, how can find same can define constraints. how alter query first unused number after that's greater 100 e.g. if have 23, 56, 100, 101, 103 in table should 102. in mysql , postgresql select id + 1 test mo not exists ( select null test mi mi.id = mo.id + 1 ) , mo.id> 100 order id limit 1 fiddle mysql , fiddle postgresql in ms sql select top 1 id + 1 test mo not exists ( select null test mi mi.id = mo.id + 1 ) , mo.id > 100 order id fiddle

bash - issues with configuration and deployment of my app -

i tried restarting server days ago sudo service httpd restart , sorts of problems have started happening. i still log vps server ssh myapp.com . enter password. comes up, usen't happen : last login: sun jul 21 22:54:02 2013 123.145-678-89.dsl.completel.net -bash: __rvm_add_to_path: command not found in terminal tried things solved problems me before like: bundle exec rake db:seed but keep getting: -bash: bundle: command not found any idea how can solve problem? i've read it's suggested @ bash_profile/bashrc files , edit things in there. these located? should change? can find deploy log , configuration? when cap production deploy:migrations transfer site online remote server used go fine, error: failed: "rvm_path=$home/.rvm/ $home/.rvm/bin/rvm-shell 'ree-1.8.7-2012.02' -c 'cd /var/www/apps/myapp/releases/20130720123042 && bundle exec rake rails_env=production rails_groups=assets assets:precompile'" on 12.34.567.8 mypc

android - Align Relative Layout at bottom of Linear Layout in Parent -

Image
i have linear layout acts parent of relative layout.the relative layout consists of buttons , stuff.i want align relative layout(panel containing buttons) @ bottom of linear layout.the linear layout consists of imageview , after relative layout should aligned @ bottom. but when try set android:layout_alignparentbottom="true" in relative layout ide prompts code wrong.how can achieve please help <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center_horizontal" android:orientation="vertical" > <imageview android:id="@+id/imageview1" android:layout_width="fill_parent" android:layout_height="250dp" android:scaletype="fitstart" android:src

jquery - jqGrid: Set in localStorage treegrid expanded after reloadGrid -

i have read this thread , have downloaded demo of oleg in code doesn't work. i have jqgrid external php json. use setinteval (1 second) refresh data in real time when explode tree closes immediately. my javascript code jquery(document).ready(function(): ` // odd row var resetaltrows = function () { $(this).children("tbody:first").children('tr.jqgrow').removeclass('odd'); $(this).children("tbody:first").children('tr.jqgrow:visible:odd').addclass('odd'); }; 'use strict'; var $grid = $('#list'), saveobjectinlocalstorage = function (storageitemname, object) { if (typeof window.localstorage !== 'undefined') { window.localstorage.setitem(storageitemname, json.stringify(object)); } }, removeobjectfromlocalstorage = function (storageitemname) { if (typeof window.localstorage !== 'u

Making Qt Application that work with different System Font Sizes -

i working on qt application targeting windows , mac os x. have lots of dialogs text in application. created application on windows, sized dialogs fit of text neatly. compiled on mac os x, realised of text doesn't fit properly. furthermore, setting different system font size in windows control panel causes of dialog sizes incorrect. how supposed handle different system font sizes in qt? you don't: let qt job you. use layouts arrange widgets; avoid setting fixed sizes. last point: recommend use qt-designer create interfaces. edit dmitry: here python files 2 ui files (generated pyuic4) each 1 2 qlabel. 1 qlabel font huge (72), other default 1 (10). min , max size constrained: here if max font size 10, label correctly displayed. from pyqt4 import qtcore, qtgui class ui_dialog(object): def setupui(self, dialog): dialog.setobjectname("dialog") dialog.resize(115, 160) sizepolicy = qtgui.qsizepolicy(qtgui.qsizepolicy.fixed, q

how to deal jquery ajax with jsp for database update? -

Image
i have used ajax jquery , ajax url calling jsp page submits form data database problem whenever i'm running insert query, replying "null values can't inserted database" kinda exception, whenever i'm reloading same page , clicking submit button, getting submitted database. think problem postback method, i'm new ajax please need help... <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#save').click(function () { $.ajax({ type: "post", url: "test.jsp", //this servlet data: "input=" +$('#id').val()+"&output="+$('#op').val(), success: function(msg){ $('#output').ap

javascript - Lesscss - when a number has no units -

how check if number has no unit less? there must shorter way than: .margin(@i) when (isnumber(@i)) , not (ispixel(@i)) , not (ispercentage(@i)) , not (isem(@i)) , not (isunit(@i,rem)) , not (@i = auto) { ... } i thought when not (isunit(@i)) trick isn't working... my goal use default unit , work unit-less functions ".font-size(10)" as possible. default unit should used when value has no unit, if has unit ".font-size(2em)" value keeps unit. when default unit "rem" or rem used unit, function must add pixel value before rem property (older browsers) , calculate rem value: ".font-size(5)" should output: (when @default-unit: rem) font-size: 5px; font-size: 0.5em; i've got working following functions: .font-size(@i) when (isunit(@i,rem)) { font-size: unit(@i*10,px); font-size: @i; } .font-size(@i) when (ispixel(@i)), (ispercentage(@i)), (isem(@i)), (@i = auto) , not (isunit(@i,rem)) , not (@i = n) { font-size: @i; }

sql - MySQL group by without column name -

i have table contains user infos. mysql> desc accounts; +-------------+------------+------+-----+---------+----------------+ | field | type | null | key | default | | +-------------+------------+------+-----+---------+----------------+ | cid | int(11) | no | pri | null | auto_increment | | username | text | yes | | null | | | password | text | yes | | null | | | mysignature | text | yes | | null | | | is_admin | varchar(5) | yes | | null | | +-------------+------------+------+-----+---------+----------------+ 5 rows in set (0.01 sec) normal group statement follows 1 or more column names below: select * accounts group cid; just example, in general group by works aggregate functions sum() . i have found follows expression without column names cant understand: mysql> select username accounts group now(); +-------

java - How class level lock is acquired -

public synchronized int getcountone() { return count++; } like in above code synchronizing on method functionally equivalent having synchronized (this) block around body of method. object "this" doesn't become locked, rather object "this" used mutex , body prevented executing concurrently other code sections synchronized on "this." on similar grounds used mutex when acquire class level lock.as in if have function public static synchronized int getcounttwo() { return count++; } obviously 2 threads can simultaneously obtain locks on getcountone(object level lock) , getcounttwo(class level lock). getcountone analogous public int getcountone() { synchronized(this) { return count++; } } is there equivalent of getcounttwo? if no criteria used obtain class level lock? on similar grounds used mutex when acquire class level lock the class object used mutex. equivalent synchronized block st

ios - alertViewShouldEnableFirstOtherButton not called -

i want show uialertview textfield. , if user has not entered valid emai id ok button of uialertview disable. i know how show uialertview , disable uialertview ok button .. my problem - (bool)alertviewshouldenablefirstotherbutton:(uialertview *)alertview not called thats why button enabled. but when user press ok button - (void)alertview:(uialertview *)alertview clickedbuttonatindex:(nsinteger)buttonindex is called. here code , -(ibaction)forgotpassbtnclicked:(id)sender { uialertview *alertview=[[uialertview alloc]initwithtitle:@"" message:@"" delegate:self cancelbuttontitle:@"ok" otherbuttontitles:nil, nil]; [alertview setalertviewstyle:uialertviewstyleplaintextinput]; uitextfield *textfield=[alertview textfieldatindex:0]; textfield.placeholder=@"enter email id"; [alertview show]; } #pragma mark alertview delgate - (bool)alertviewshouldenablefirstotherbutton:(uialertview *)alertview { uitextfield *text1=[alertview text

javascript - Moving a KineticJS line with a transition -

i using fantastic kineticjs javascript framework illustrations. i have number of tweens in illustrations funky transitions. my problem am trying move kinetic.line() object across illustration smoothly. the docs kineticjs can use tweens transition "any numeric property of shape". know points in kinetic.line() object not numeric, object property. there way access kline_movingline.attrs.points[0].x used in tween. my lines simple. have 2 points (from , points). you can still tween line tween shape changing it's properties! var line = new kinetic.line({ x: 100, y: 100, points: [0, 0, 50, 50], stroke: '#ff0000' }); var tween = new kinetic.tween({ node: line, duration: 1, x: 400, y: 30, points: [100, 50, 25, 0] }); in above example, used tween change x, y , points properties. check fiddle , see works expected: jsfiddle

c - Arthmetic operation in structure -

is possible in c language: typedef struct s { char a; int b; int c = this.a * 60 + this.b; } s; such type of structure usefull in code. no, in c can't assign remember value in declaration, compilation time error. but 1 solution can suggest(may like): #define init(this, a, b) {a, b, (this).a * 60 + (this).b} and call it: s s = init(s, '5', 6);

linq to entities - How to compare numeric and string values same times in Entity framework in C# with Lambda expression -

Image
i want compare search value table columns fields, if compare string values contains property, no error in case comparing both numeric , string values, showing does not take 1 argument as displayed in attached picture you using single = assignment operator. comparison use == operator: where(p => p.venername.contains(searchtext) || p.primarycontact == id)

jquery - Clone Link on Column To Another Column in Table -

i want create td , link image after td:nth-child(2) , clone link a.link_topic_title i have make script, link clone link on first row $(document).ready(function () { $('#preview_active').change(function () { if ($(this).is(':checked')) { var url_thread = $('.link_topic_title').attr("href"); var url_tooltip = "http://domain.com" + url_thread $(".zebra thead tr th:first-child").attr('colspan', 4); $('.zebra tbody tr td:nth-child(2)').after('<td class="span1 icon"><a href="' + url_thread + '"><img src="http://icons.iconarchive.com/icons/visualpharm/must-have/256/preview-icon.png" height="30px" width="25px" rel="tooltip" data-original-title="' + url_tooltip + '"/></a></td>'); $('.zebra tbody tr td:nth-child(3) img[