Changing the value of a structure from another structure

I have just read Extending a struct in C and I don't seem to understand what certain part of the code does. Here is his current code: typedef struct A { int x; }A; typedef struct B { A a; int d; }B; void fn(){ B *b; ((A*)b)->x = 10; } I wonder, how d

How do I convert a list of dictionary lists into C #?

I have a list of boxes(unique, with id) and in each box there are certain items(unique, with id). Example: list<box> boxes = new list<boxes>; where, class box { ... list<item> items = new list<item>; ... } Box1: item1, item2, ... B

Highlight some words in Eclipse

I am writing spock tests in Groovy / Grails in Eclipse. These use key words such as setup: the: and when:. I'd like to be able to add some syntax highlighting to these words. Is this possible? Thanks.Please try the Spock Eclipse plugin: http://market

How do I perform an asynchronous action in an accessor?

I have a simple accessor in my class: public function get loggedIn():Boolean { var loggedIn:Boolean = somePrivateMethodToCheckStatus(); return loggedIn; } The API I'm now working with checks login status in an asynchronous fashion: API_Class.addEvent

Try to load the Zen theme into Bitnami Drupal

I want to use Zen theme in Bitnami Drupal, but when I extract the package in the drupal/htdocs/theme folder, I still don't see the theme listed under Appearances. Any suggestions? Thanks!Put your theme to the sites/all/themes subfolder (relative to D

Join a part of the chain

I have following tables: **visitors** +---------------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------------------+--------------+------+-----+---------+----------------+ | visi

Django ORM SELECT with join

Models in django: class Key(models.Model): id = models.AutoField(primary_key=True, blank=True) name = models.CharField(max_length=50) class Record(models.Model): id = models.AutoField(primary_key=True, blank=True) project_id = models.IntegerField() n

How to define the CSS style for fields marked as required?

I have an application that is AngularJS and Bootstrap, although I am not sure if it is relevant. I want to define CSS style for required fields. I see many examples if the field has class='required', for example here: .form-group.required .control-la

When to use CALayer on Mac / iPhone?

I'm slightly confused when to use CALayer on the iPhone or Mac and when not to use it? CoreAnimation works just fine on my UIView based objects without having to use CALayer. When is the appropriate time to dig into this class?In my benchmarks, UIVie

How do you build a string with a user-defined length?

I need to be able to generate strings with a user defined length. For example, if the user enters 128, I need a string with 128 characters. Any ideas on how to accomplish this?You can create X random chars (in a loop) and use a StringBuffer to concat

Python - automating the MySQL query: passing parameter

The code in the sequence is working fine, but looking to improve the MySQL code to a more efficient format. The first case is about a function that received a parameter and returns the customerID from MySQL db: def clean_table(self,customerName): get

Scroll through a list of Python numbers and keep the sum

I have a list or an array of decimal numbers in Python. I need to round them to the nearest 2 decimal places as these are monetary amounts. But, I need the overall sum to be maintained, i.e. the sum of the original array rounded to 2 decimal places m

Implementing fuzzy search / word completion suggestions

I have a list of a bunch of phrases. Because this is a fairly long list, I also have a text box which users can type into as a search bar. As of right now, terms that do not exactly contain with the letters in the search bar are filtered out. However

How to select the date and the oldest data corresponding to it

I have a very simple question that's kicking my ass. CUSTNMBR | first_date | SOPNUMBE ---------------------------------------- 3344771005 | 2012-05-03 | 334471961748 3344771005 | 2012-04-04 | 334476873726 In the above table i want to return the earli

Custom Tags in UiBinder

When using a <g:LayoutPanel> in UiBinder.ui.xml files, you can specify <g:layer> tags. Some other Google-built widgets have special tags like that as well - <g:tab> even has a sub-tag, <g:header>. How can I specify these for my own

What is the shortcut to Debugging in PyDev using Eclipse

The shortcut key is F11 to start debugging. But issue is that I have to be on that file and then hit F11 to start debugging. Eg. my file to launch the application is "" and "". is open in the editor wherea

Does the Android API support the user interface?

I wonder know if is there any kind of support for console UI on Android platform. I mean something like printf / scanf C functions or the System.Out / Java classes with relative console creation. e.g. Symbyan Platforms have CConsole class,

Localstorage as the Javascript function attribute value

I have a class / function called MyApp and have some special attributes init for example this.memory and this.userMedia to access these functions within my own app I don't know if this copies the function or just uses the reference for the function?

What are these characters (pret) and how can I solve this?

I just don't know where I'm supposed to ask this, I don't know much about computers, feel free to direct me to the right forum, I searched for this but could not find out where to post. Anyhow, I was doing search and came across this website: http://

Rename the table to sqlite

I am trying to rename a table in my app's sqlite database. For that I am using the following command: ourDatabase.rawQuery("ALTER TABLE " + oldName + " RENAME TO " + newName, null); where oldName is old name of the table, newName is th

How can I access the Wayback machine programmatically?

What I'm trying to do For a list of websites, I want to get the pages indexed by year, if they were archived at any point that year. So if I'm looking at and, I want to be able to get: 2010:, (the h

restructure table in php

I have the following source array which I'm trying to restructure using group_name to give me the require output below. Any help or pointers appreciated. Thanks, Lk Source: Array ( [field_a] => Array ( [type] => text [group_name] => ) [field_b] =

No items returned from the table

I asked a question about same code but got lost in translation Here's what the question comes down to. I validate if a certrain var is a an array, then I want an element out of it but returns no value. What's going on? EDIT: I'm adding the code that